在Play前配置Nginx作为反向代理!并通过以下标题集传递https: -
proxy_set_header X-Forwarded-Proto https;
proxy_set_header X-Forwarded-Ssl https;
Run Code Online (Sandbox Code Playgroud)
login()[ https://localhost/login]正在转发给Play!在端口9000上为'http'.但是login()中的request.secure仍然是'false'.任何的想法 ?
更新:这是服务器conf: -
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;
}
}
Run Code Online (Sandbox Code Playgroud)
第二个条目是错误的,它应该是:
proxy_set_header X-Forwarded-Ssl on;
Run Code Online (Sandbox Code Playgroud)
这将解决问题
更新:无法测试,我唯一看到的是这个标题:
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
Run Code Online (Sandbox Code Playgroud)
除此之外,一切似乎都是正确的
| 归档时间: |
|
| 查看次数: |
3621 次 |
| 最近记录: |