Search code examples
ruby-on-railsopenproject

openproject, probleme in link generator for confirmation with email


i am using openproject on myserver on port 7000, but when i send an email invitation for a user, it generates the activation url without the port my server is listening on for openproject,

https://myserver/account/activate?token=..

instead of

https://myserver:7000/account/activate?token=..

the link is generated in app/mailers/user_mailer.rb using url_for function,

, thank you


Solution

  • You need to add something like this in your application_controller.rb:

    default_url_options[:port] = 7000 if Rails.env.production?
    

    More info: apidock/default_url_options

    Better way for action_mailer

    Using environments config as you've said in comments, like this:

    config.action_mailer.default_url_options = { host: 'myserver', port: 7000 }