Nginx can not forward the request protocol correctly to upstream

前端 未结 2 946
眼角桃花
眼角桃花 2020-12-09 11:03

I have a website in rails 4 beta. It is running on Nginx + Unicorn. I want nginx to forward the request protocol ( \'http\' or \'https\' ) to unicorn so that I can work with

2条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-09 11:26

    try:

    proxy_set_header X-Forwarded-Proto $scheme;
    

    OR

    server {
        Listen 80
        ...
    }
    server {
        Listen 443
        ...
        location @unicorn {
            proxy_set_header X-Forwarded-Proto https;
            proxy_set_header X-Forwarded-Ssl on;
        }
    }
    

提交回复
热议问题