nginx代理https后,应用redirect https变成http

情况说明

nginx 代理https后,应用redirect https变成http

情况类似

http://2hei.net/mt/2010/02/request-getscheme-cannt-get-https.html

http://yywudi.info/nginx-https-400-bad-request-solution/

原因分析:

浏览器到nginx是https,nginx到应用服务器变成http,

应用服务器,再做302 redirect的时候,返回的redirect 地址就好变成http的地址;

原因是spring mvc的servlet的secheme取值,request.getScheme()

是取请求里的一个scheme值,所有这个值在nginx代理时要设置成https

其中: request.getScheme() return http but not https.

解决方法:

目前是

proxy_redirect http:// $scheme://;

具体说明,还没仔细调查,有时间在细致研究下
参考:

http://serverfault.com/questions/372886/prevent-nginx-from-redirecting-traffic-from-https-to-http-when-used-as-a-reverse

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

这个站点使用 Akismet 来减少垃圾评论。了解你的评论数据如何被处理

相关文章

开始在上面输入您的搜索词,然后按回车进行搜索。按ESC取消。

返回顶部