Tailscale serve support (#2126)

Ensure we can serve the app from multiple hosts without breaking links.
* Switch unnecessary full URLs to paths
* Drop default host/port URL options for controllers

Shell 1
```bash
bin/dev
```

Shell 2
```bash
tailscale serve http://fizzy.localhost:3006
```
This commit is contained in:
Jeremy Daer
2025-12-13 09:29:50 -08:00
committed by GitHub
parent 43ab17df2f
commit 82626f020d
3 changed files with 12 additions and 7 deletions
+9 -4
View File
@@ -85,9 +85,14 @@ Rails.application.configure do
config.action_mailer.raise_delivery_errors = false
end
config.hosts = %w[ fizzy.localhost localhost 127.0.0.1 ] + [ /^fizzy-\d+(:\d+)$/ ]
config.hosts = [
"fizzy.localhost",
"localhost",
"127.0.0.1",
/^fizzy-\d+(:\d+)?$/, # review apps: fizzy-123:3000
/\.ts\.net$/ # tailscale serve: hostname.tail1234.ts.net
]
# Set host to be used by links generated in mailer and notification view templates.
config.action_controller.default_url_options = { host: config.hosts.first, port: 3006 }
config.action_mailer.default_url_options = { host: config.hosts.first, port: 3006 }
# Canonical host for mailer URLs (emails always link here, not personal Tailscale URLs)
config.action_mailer.default_url_options = { host: "#{config.hosts.first}:3006" }
end