gpt4 book ai didi

nginx - (https)Nginx --> (http) Play !。但是 request.secure 是假的

转载 作者:行者123 更新时间:2023-12-03 23:50:07 24 4
gpt4 key购买 nike

在 Play 前面将 Nginx 配置为反向代理!并通过 https
设置了以下标题:-

        proxy_set_header   X-Forwarded-Proto https; 
proxy_set_header X-Forwarded-Ssl https;
login() [ https://localhost/login ] 正在转发 Play !在港口
9000 作为“http”。但是 login() 中的 request.secure 仍然是“假”。有什么想法吗?

更新:
这是服务器配置:-
server {
listen 443;
server_name localhost;

ssl on;
ssl_certificate /home/aymer/play/key/localhost.crt;
ssl_certificate_key /home/aymer/play/key/localhost.key;
ssl_session_timeout 5m;

location ~ ^/(images|javascript|js|css|flash|media|static)/ {
root /home/aymer/play/playapp/public;
expires 30d;
}

location ~* (login|register)$ {
proxy_pass http://localhost:9000;
proxy_redirect off;

proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-Proto https;
proxy_set_header X-Forwarded-Ssl on;
}

location / {
rewrite ^/(.*) http://$host/$1 permanent;
}
}

最佳答案

第二个条目是错误的,应该是:

proxy_set_header   X-Forwarded-Ssl on; 

这将解决问题

更新:无法测试,我看到唯一缺少的是这个标题:
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

除此之外,一切似乎都是正确的。

关于nginx - (https)Nginx --> (http) Play !。但是 request.secure 是假的,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6325856/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com