From 1b718fe238bbca95509ade686d03510d8633d3b8 Mon Sep 17 00:00:00 2001 From: maebeale Date: Tue, 6 Jan 2026 16:00:00 -0500 Subject: [PATCH] Change action_mailer's default_url_options for host to use the same env var as we're using for routes (links in password reset emails were opening up example.com) --- config/environments/production.rb | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/config/environments/production.rb b/config/environments/production.rb index 5a13a0a6..63778082 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -50,7 +50,6 @@ config.active_storage.service = :digitalocean app_host = ENV.fetch("APP_HOST", "localhost") - Rails.application.routes.default_url_options[:host] = app_host config.after_initialize do @@ -96,8 +95,8 @@ # Set host to be used by links generated in mailer templates. config.action_mailer.default_url_options = { - host: "example.com", - protocol: "https" + host: ENV.fetch("APP_HOST", "localhost"), + protocol: Rails.env.production? ? "https" : "http" } # Specify outgoing SMTP server. Remember to add smtp/* credentials via bin/rails credentials:edit.