Rails url helper does not respect "relative_url_root" configuration in mailer
Given an application mounted at:
https://www.domain.com/app1
Following config is added in application.rb to make sure all links are prepended with /app1:
config.action_controller.relative_url_root = '/app1'
However, if you are generating an URL in mailer view using url helper, this config is not automatically used. You need to specify the path using script_name in the "default_url_options" config. E.g.
config.action_mailer.default_url_options = { host: 'www.domain.com', port: 443, protocol: 'https', script_name: '/app1' }
With this your URL generated in the email would be correct.
AI Summary
Chrome On-device AI
2024-12-06 19:51:33
Share Article