java redirect https jump http problem

1. Premise
nginx: https
tomcat:http
java:springmvc

2. Problem description Access to nginx
through https, and tomcat through nginx proxy_pass to http.
Normal access is normal, but as long as java redirects, it jumps to http.


3. Solutions
            proxy_pass http://10.0.1.107:8080;
            proxy_set_header Host $host:$server_port;
            proxy_redirect http:// https://;


Implementation process: Complete Location http to https according to the different execution stages of nginx.
1. Before proxy_pass is executed, set the request head host as the domain name + port for https external network access
2. After proxy_pass is executed, the tomcat result returns the response
3. proxy_redirect modifies the protocol in the location in the response http to the https external network access protocol .

Because there is no time recently, there is no typesetting, and debugging this problem has beented a lot of time. I checked a lot of information, this is accurate. I mainly want to document the execution phase of nginx.
quote
http://blog.csdn.net/lindev/article/details/23952395


Fourth, java redirect
This is mainly determined by accessing the head item of the tomcat request. The default is the http protocol. The domain name is read by the host address. The default host does not include the access port.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326269317&siteId=291194637