diff --git a/README.md b/README.md index c7625286c..58a1a9682 100644 --- a/README.md +++ b/README.md @@ -73,7 +73,7 @@ Beta is primarily intended for testing product features. Beta tenant is: -- https://fizzy.37signals.works/ +- https://fizzy-beta.37signals.com This environment uses local disk for Active Storage. diff --git a/config/environments/beta.rb b/config/environments/beta.rb index c7f44040b..c67135679 100644 --- a/config/environments/beta.rb +++ b/config/environments/beta.rb @@ -1,7 +1,11 @@ require_relative "production" Rails.application.configure do - config.action_mailer.default_url_options = { host: "%{tenant}.37signals.works" } + config.hosts = [ "fizzy-beta.37signals.com" ] + config.hosts[1..] + + config.action_mailer.smtp_settings[:domain] = config.hosts.first + config.action_mailer.smtp_settings[:address] = "smtp-outbound-staging" + config.action_mailer.default_url_options = { host: config.hosts.first, protocol: "https" } # Let's keep beta on local disk. See https://github.com/basecamp/fizzy/pull/557 for context. config.active_storage.service = :local diff --git a/config/environments/development.rb b/config/environments/development.rb index 24fc6c04c..002ee99ed 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -75,6 +75,11 @@ Rails.application.configure do # Allow all hosts in development config.hosts = nil + config.hosts = %w[ fizzy.localhost localhost 127.0.0.1 ] + + # Host to be used in links rendered from ActionMailer + config.action_mailer.default_url_options = { host: config.hosts.first, port: 3005 } + if Rails.root.join("tmp/solid-queue.txt").exist? config.active_job.queue_adapter = :solid_queue config.solid_queue.connects_to = { database: { writing: :queue } } diff --git a/config/environments/production.rb b/config/environments/production.rb index 73f7f6f1b..664c60834 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -73,8 +73,17 @@ Rails.application.configure do # Set this to true and configure the email server for immediate delivery to raise delivery errors. # config.action_mailer.raise_delivery_errors = false + # Enable DNS rebinding protection and other `Host` header attacks. + config.hosts = [ + "fizzy.37signals.com", + "localhost", + IPAddr.new("172.17.0.0/20") # Docker VPC + ] + # Set host to be used by links generated in mailer templates. - config.action_mailer.default_url_options = { host: "%{tenant}.fizzy.37signals.com" } + config.action_mailer.default_url_options = { host: config.hosts.first, protocol: "https" } + + config.action_mailer.smtp_settings = { domain: config.hosts.first, address: "smtp-outbound", port: 25, enable_starttls_auto: false } # Enable locale fallbacks for I18n (makes lookups for any locale fall back to # the I18n.default_locale when a translation cannot be found). @@ -86,11 +95,6 @@ Rails.application.configure do # Do not dump schema after migrations. config.active_record.dump_schema_after_migration = false - # Enable DNS rebinding protection and other `Host` header attacks. - # config.hosts = [ - # "example.com", # Allow requests from example.com - # /.*\.example\.com/ # Allow requests from subdomains like `www.example.com` - # ] # Skip DNS rebinding protection for the default health check endpoint. # config.host_authorization = { exclude: ->(request) { request.path == "/up" } } end diff --git a/config/environments/staging.rb b/config/environments/staging.rb index 27868fd80..7bee9c845 100644 --- a/config/environments/staging.rb +++ b/config/environments/staging.rb @@ -1,5 +1,9 @@ require_relative "production" Rails.application.configure do - config.action_mailer.default_url_options = { host: "%{tenant}.fizzy.37signals-staging.com" } + config.hosts = [ "fizzy.37signals-staging.com" ] + config.hosts[1..] + + config.action_mailer.smtp_settings[:domain] = config.hosts.first + config.action_mailer.smtp_settings[:address] = "smtp-outbound-staging" + config.action_mailer.default_url_options = { host: config.hosts.first, protocol: "https" } end