成功登录Chrome重定向到HTTP之后,Nginx(HTTPS)上游Springboot(HTTP)



Springboot应用在8080

上开始

nginx传入请求:443代理:8080

启动页面在https://site/n.在Springboot Chrome登录后登录到http://site/(不是https://site/)为什么???如何修复

请求URL:https://site/login

请求方法:发布

状态代码:302

远程地址:85.26.149.68:443

推荐人策略:无引用者 - 当downgrade

响应标头

http/1.1 302

服务器:nginx/1.14.0

日期:2019年2月25日星期一11:40:17 GMT

内容长度:0

连接:keep-alive

set-cookie:jsessionId = 5196d2d1a7a681bbf713bd3af61f14ff;路径=/;httponly

x-content-type-options:nosniff

X-XSS保护:1;模式=块

缓存控制:无循环,不存储,max-age = 0,必备

PRAGMA:无循环

到期:0

X框架:否认

位置:http://site/

和Chrome Redirect在登录后页页面http://site/为什么????????????

upstream spring_boot_srv {
    server localhost:8080 fail_timeout=0;
}
server {
   listen         80;
   server_name    site;
   return         301 https://$server_name$request_uri;
}
server {
    server_name site;
    listen 443;
    ssl on;
    ssl_session_timeout 5m;
    ssl_protocols SSLv2 SSLv3 TLSv1 TLSv1.1 TLSv1.2;
    ssl_certificate_key /media/some.key;
    ssl_certificate /media/some.crt;
    ssl_session_cache shared:SSL:10m;
    location / {
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header Host $host:$proxy_port;
        proxy_set_header X-Forwarded-Proto https;
        proxy_redirect off;
        proxy_connect_timeout      240;
        proxy_send_timeout         240;
        proxy_read_timeout         240;
        proxy_pass http://spring_boot_srv;
    }
 }

在您的application.properties

中添加以下条目
server.tomcat.remote_ip_header=x-forwarded-for
server.tomcat.protocol_header=x-forwarded-proto

有关更多信息

相关内容

最新更新