A colleague asked for help: the login to the backend system was successful, but the system could not be logged in successfully, and it still jumped to the login page, but there was no problem with the same set of code in another environment. background It was learned that he used Tomcat to deploy two environments for the same project, one on the development server and one on his local computer, and the code configurations of the two environments were exactly the same. Both sides use the same nginx for reverse proxy. The nginx configuration is as follows: location /health/ { proxy_pass http://192.168.40.159:8081/health/; #No problem with the configuration} location /health-dev/ { proxy_pass http://192.168.40.202:8080/health/; #Problematic configuration} One reverse proxy to the development environment, and one reverse proxy to the local service. position Since the code configuration is exactly the same, the problem is most likely in the nginx reverse proxy. Because the location paths on both sides are different (that is, the browser paths are different), but the server paths of the reverse proxy are the same, combined with the basic principles of session, as shown in the following figure,
When nginx reverse proxy is configured in this way location /health-dev/ { proxy_pass http://192.168.40.202:8080/health/; } When the browser accesses Because the path Therefore, the next time you request the server, the browser cannot set solve nginx has a command location /health-dev/ { proxy_pass http://192.168.40.202:8080/health/; proxy_cookie_path /health /health-dev; } Restart nginx and the problem is solved. This is the end of this article about how to solve the problem of session invalidation caused by nginx reverse proxy. For more information about session invalidation caused by nginx reverse proxy, please search for previous articles on 123WORDPRESS.COM or continue to browse the following related articles. I hope you will support 123WORDPRESS.COM in the future! You may also be interested in:
|
>>: Solutions to problems using addRoutes in Vue projects
Table of contents Preface 1. Common bug fixes in ...
HTML web page list tag learning tutorial. In HTML ...
Two days ago, I took advantage of the Double 11 s...
As the Internet era becomes more mature, the deve...
How to allow remote connection in MySql To achiev...
MySQL multi-condition query with AND keyword. In ...
Set the background image for the table header. Yo...
Core code /*-------------------------------- Find...
Recently, the company has begun to evaluate all s...
1. The Chinese garbled characters appear in MySQL...
1. Put the mask layer HTML code and the picture i...
Linux basic configuration Compile and install pyt...
Principle: First hide the input element, then use...
Preface This is an investigation caused by the ex...
Table of contents 1. Environment variable $PATH: ...