diff --git a/config/environments/development.rb b/config/environments/development.rb index 557000065..7a41f426a 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -34,7 +34,8 @@ Rails.application.configure do config.active_job.queue_adapter = :sidekiq - Rails.application.routes.default_url_options = { host: ENV['FRONTEND_URL'] } + host = ENV['FRONTEND_URL_EXTERNAL'].presence || ENV['FRONTEND_URL'] + Rails.application.routes.default_url_options = { host: host } # Print deprecation notices to the Rails logger. config.active_support.deprecation = :log diff --git a/config/environments/production.rb b/config/environments/production.rb index a9504fc5c..303a42fa3 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -102,5 +102,6 @@ Rails.application.configure do # :sendgrid for Sendgrid config.action_mailbox.ingress = ENV.fetch('RAILS_INBOUND_EMAIL_SERVICE', 'relay').to_sym - Rails.application.routes.default_url_options = { host: ENV['FRONTEND_URL'] } + host = ENV['FRONTEND_URL_EXTERNAL'].presence || ENV['FRONTEND_URL'] + Rails.application.routes.default_url_options = { host: host } end diff --git a/config/environments/staging.rb b/config/environments/staging.rb index ed7cc0e84..df7fcea00 100644 --- a/config/environments/staging.rb +++ b/config/environments/staging.rb @@ -50,7 +50,8 @@ Rails.application.configure do # config.active_job.queue_adapter = :resque # config.active_job.queue_name_prefix = "chatwoot_#{Rails.env}" - Rails.application.routes.default_url_options = { host: ENV['FRONTEND_URL'] } + host = ENV['FRONTEND_URL_EXTERNAL'].presence || ENV['FRONTEND_URL'] + Rails.application.routes.default_url_options = { host: host } # Enable locale fallbacks for I18n (makes lookups for any locale fall back to # the I18n.default_locale when a translation cannot be found).