Rails redirecting failed after deploying on server

I’ve tested locally and every function work alright, but when i deployed it on a server using nginx and reverse proxy with http, the functions worked well except every redirection.

Does anyone know the reason?

For a problem like that, I suggest using “curl -i https://your-url” to investigate why the response isn’t what you expect. There should be a redirection HTTP code in the response and a Location: header to say where to go to.

You most likely have force_ssl = true in config/environments/production.rb which is a good thing but you don’t include enough about how everything else is configured to help much beyond that.