---
title: "nginx 代理https后，应用redirect https变成http"
author: "hzp"
date: "2015-08-12T11:07:35Z"
tags: []
categories: ["互联网"]
slug: "nginx-https-redirect-https-http"
draft: false
lastmod: "2015-08-12T11:07:35Z"
id: 2234738
url: "https://hzp.iteye.com/blog/2234738"
---

配置 Nginx 的转发选项：  
proxy\_set\_header X-Forwarded-Proto $scheme;

配置Tomcat server.xml 的 Engine 模块下配置一个 Value：  
&lt;Valve className="org.apache.catalina.valves.RemoteIpValve" remoteIpHeader="X-Forwarded-For" protocolHeader="X-Forwarded-Proto" protocolHeaderHttpsValue="https"/&gt;

配置双方的 X-Forwarded-Proto 就是为了正确地识别实际用户发出的协议是 http 还是 https。