I'm using Devise and Rack::SSLEnforcer in a Rails app. When users receive their confirmation email, it looks something like:
http://mysite.com:443/users/confirmation?confirmation_token=123456789xxx
The link is auto-generated by Devise's confirmation_url method.
This link shouldn't have the port 443 attached to it. In theory, I don't need the link to be to the https address, but it's fine if it is. At minimum, it should be https at the front, not port 443 at the end.
Any ideas?
I solved this problem by installing the Devise views and customizing the link being generated. You can install the Devise views with this command:
rails generate devise:views
Make sure to read the Devise documentation because you may need to customize some other stuff when you do this (depending on your particular situation).
With that complete, you can now edit the file at
app/views/devise/mailer/confirmation_instructions.html.erb
To make the link always generate as SSL, just customize the link_to
call:
<%= link_to 'Confirm my account', confirmation_url(@resource, :confirmation_token => @resource.confirmation_token, :protocol => "https") %>