I'm facing a strange bug when I follow confirmation link from devise email. The link is correct:
.../ru/users/confirmation?confirmation_token=yDNePwDTbxBzy5PqZE1e
However in server log I get:
Started GET "/ru/users/confirmation?confirmation_token=yDNePwDTbxBzy5PqZE1e?confirmation_token=yDNePwDTbxBzy5PqZE1e"
As you see it is mentioned twice. For this reason I can't confirm the email.
The strangest thing is that it works in webrick, and I only see this issue in production (which happen to be nginx + passenger).
It might be the problem with my setup. I'm using Rails v4, and Devise v3. I re-wrote default devise confirmation#edit controller, and a couple of others, since I wanted to implement "sign-up by email" strategy, and also use ldap_authenticatable model instead of database_authenticatable. I also patched ldap_authenticatable to support multiple LDAPs. But even so -- can you point me where I should look to dig into my issue?
Edit
Middleware: production environment is 4 entries shorter:
production
$ RAILS_ENV=production bundle exec rake middleware use Rack::Sendfile use Rack::Lock use Rack::Runtime use Rack::MethodOverride use ActionDispatch::RequestId use Rails::Rack::Logger use ActionDispatch::ShowExceptions use ActionDispatch::DebugExceptions use ActionDispatch::RemoteIp use ActionDispatch::Callbacks use ActiveRecord::ConnectionAdapters::ConnectionManagement use ActiveRecord::QueryCache use ActionDispatch::Cookies use ActionDispatch::Session::CookieStore use ActionDispatch::Flash use ActionDispatch::ParamsParser use Rack::Head use Rack::ConditionalGet use Rack::ETag use Warden::Manager run Login::Application.routes
development:
$ RAILS_ENV=development bundle exec rake middleware use Rack::Sendfile + use ActionDispatch::Static use Rack::Lock use Rack::Runtime use Rack::MethodOverride use ActionDispatch::RequestId use Rails::Rack::Logger use ActionDispatch::ShowExceptions + use WebConsole::Middleware use ActionDispatch::DebugExceptions use ActionDispatch::RemoteIp + use ActionDispatch::Reloader use ActionDispatch::Callbacks + use ActiveRecord::Migration::CheckPending use ActiveRecord::ConnectionAdapters::ConnectionManagement use ActiveRecord::QueryCache use ActionDispatch::Cookies use ActionDispatch::Session::CookieStore use ActionDispatch::Flash use ActionDispatch::ParamsParser use Rack::Head use Rack::ConditionalGet use Rack::ETag use Warden::Manager run Login::Application.routes
Edit 2
I found out what was the reason: the link in the email was http. If I change that to https -- it works. So one just have to add
config.action_mailer.default_url_options = {:protocol => 'https'}
in config/environments/production.rb
and it works (on web-server restart). source