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
Preview of revised version This article was writt...
1. First, you need to know what will trigger the v...
Table of contents variable Data Types Extension P...
Preface This article was written by a big shot fr...
MySQL Workbench - Modeling and design tool 1. Mod...
Preface This article mainly introduces the releva...
Fault description percona5.6, mysqldump full back...
This article introduces blue-green deployment and...
Table of contents Preface How does antd encapsula...
1. What is Parallax scrolling refers to the movem...
Table of contents Solution 1: Copy the transfer c...
Table of contents 1. Title 2. Code 3. Results IV....
Preface echarts is my most commonly used charting...
Table of contents 1. Picture above 2. User does n...
background A colleague is working on his security...