重定向https转http转https

问题描述:

最近服务重构,之前是war包部署到tomcat下,重构后项目采用springboot框架内嵌tomcat容器打成jar包部署。nginx配置为https访问,当后台服务重定向后多了一层301,response headers的location转成了http协议,导致https下iframe嵌入该转发接口无法访问

现象描述:

访问链接后端重定向302时localtion从https变成http,再301从http到https。
302->301->200
在这里插入图片描述
在这里插入图片描述

在这里插入图片描述
解决办法:
springboot内置tomcat配置

server:
   	use-forward-headers: true
  	tomcat:
    	remote-ip-header: X-Forwarded-For
	    protocol-header: X-Forwarded-Proto
	    protocol-header-https-value: https
	    

版权声明:本文为github_39424631原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。