As the title says, I have a Rails 6 app running in Heroku, with the automatic SSL certificate that Heroku provides. Everything works great, and I can visit any page and it gets the https
working fine. However, there is one exception: When users sign up and they get the confirmation email, clicking the link does not work for some reason (see attached screenshots below), and the same happens even if you copy+paste the link in a new tab, of course.
This is what I get when trying to access that url https://my_domain.com/users/confirmation?confirmation_token=foobar
.
My environments/production.rb
has these settings:
Rails.application.configure do
# a few more non important things, and then:
config.action_mailer.delivery_method = :smtp
config.action_mailer.perform_deliveries = true
config.action_mailer.smtp_settings = {
:user_name => ENV['SENDGRID_USERNAME'],
:password => ENV['SENDGRID_PASSWORD'],
:domain => 'my_domain.com',
:address => 'smtp.sendgrid.net',
:port => 587,
:authentication => :plain,
:enable_starttls_auto => true
}
config.force_ssl = true
config.action_mailer.default_url_options = { :host => 'my_domain.com' }
end
And this is what it looks like in Heroku:
I have these routes for Devise:
Rails.application.routes.draw do
devise_for :users, controllers: { registrations: 'users/registrations',
confirmations: 'users/confirmations' }
authenticated :user do
root to: "depots#index", as: :authenticated_root
end
root to: "public/welcome#index"
end
And the controller looks like this:
class Users::ConfirmationsController < Devise::ConfirmationsController
def after_confirmation_path_for(resource_name, resource)
sign_in(resource)
authenticated_root_path
end
end
Do you guys have any idea on what could be wrong? And if not, any advice on how to troubleshoot this?
UPDATE Aug, 04, 2020:
I had added this redirect to my domain but even though it works redirecting from grownis.com
to www.grownis.com
it doesn't for https://grownis.com
Your certificate is not wildcard certificate. Please check this link.
The confirmation link is https://grownis.com/users/confirmation?confirmation_token=CONRIMATION_TOKEN
You will need to make a redirection from non-www to www or purchase wildcard certificate.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.