NGINX访问https跳转到http的解决方法

栏目: 服务器 · Nginx · 发布时间: 9年前

内容简介:NGINX访问https跳转到http的解决方法
  • A+

所属分类:Nginx

问题:浏览器打开https://www.ttlsa.com/aaa.html,然后跳转到http://www.ttlsa.com/aaa.html

网站架构:用户--https--->nginx代理---http---->tomcat/nginx+php

nginx待遇发给后端的请求是http协议,后端程序跳转获取到的协议是http,返回一个redirect(http header中带Location:http://www.ttlsa.com/aaa.html),浏览器收到location,跳转到了location指定的地方。

解决方法

解决方法1:

在nginx代理中增加一个header,标志用户请求是http还是https,后端获取header决定跳转到http/https页面。这个方法需要修改nginx配置和程序,不推荐,但是可以解决问题。

解决方法2

nginx代理中配置proxy_redirect

proxy_redirect http:// $scheme://;

以上指令会将后端响应header location内容中的http://替换成用户端协议https://。

NGINX访问https跳转到http的解决了~

收 藏

NGINX访问https跳转到http的解决方法

微信公众号

扫一扫关注运维生存时间公众号,获取最新技术文章~


以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持 码农网

查看所有标签

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们。

Measure What Matters

Measure What Matters

John Doerr / Portfolio / 2018-4-24 / GBP 19.67

In the fall of 1999, John Doerr met with the founders of a start-up he’d just given $11.8 million, the biggest investment of his career. Larry Page and Sergey Brin had amazing technology, entrepreneur......一起来看看 《Measure What Matters》 这本书的介绍吧!

URL 编码/解码
URL 编码/解码

URL 编码/解码

HEX CMYK 转换工具
HEX CMYK 转换工具

HEX CMYK 互转工具

HSV CMYK 转换工具
HSV CMYK 转换工具

HSV CMYK互换工具