Why am I getting infinite redirect loop with force_ssl in my Rails app?

前端 未结 2 1229
鱼传尺愫
鱼传尺愫 2020-12-07 08:32

I want to have my API controller use SSL, so I added another listen directive to my nginx.conf

upstream unicorn {
  server unix:/tmp/unicorn.foo.sock fail_ti         


        
2条回答
  •  心在旅途
    2020-12-07 09:07

    Try setting this directive in your nginx location @unicorn block:

    proxy_set_header X-Forwarded-Proto https;

    I had this same issue and investigating the Rack middleware handler (not force_ssl but similar) I could see that it was expecting that header to be set to determine if the request was already processed as being SSL by nginx.

提交回复
热议问题