I have app with domain 'www.mysite.com' which is hosting Drupal and 'app.mysite.com' hosting Rails app.
I have situation where the devise mailer url points to 'www.mysite.com' instead of 'app.mysite.com'.
In devise.rb, I've settings as shown below:
config.mailer = "Devise::Mailer"
ActionMailer::Base.default_url_options = { :host => 'app.mysite.com' }
And in production.rb:
config.action_mailer.default_url_options = { :host => 'app.mysite.com' }
ActionMailer::Base.smtp_settings =
{
:address => 'smtp.sendgrid.net', # SendGrid SMTP server
:domain => 'mysite.com', # SendGrid account domain name
:user_name => 'username', # SendGrid user name
:password => 'password', # SendGrid password
:enable_starttls_auto => true,
:port => 587,
:authentication => :plain,
}
In views/devise/mailer/reset_password_instructions.html.erb, confirmation link looks something as shown below:
<%= link_to 'Change my password', edit_password_url(@resource, :reset_password_token => @resource.reset_password_token) %>
It successfully sends the email after clicking forgot password link and works like charm on localhost but the url host points to www.mysite.com
instead of app.mysite.com
and throws 404 error.
How can I point it to right host?