About Nginx reverse proxy configuration issues after SpringSecurity authentication failure to solve

Background problem

Recently I wrote a project, separate front and rear end approach to development, login authentication using SpringSecurity framework.

Problem Description

Appears when the project deployment of a problem when running on their computers all smooth, but deployed to the server has been login failures were tested front-end and back-end code, run independently without problems, turn on the prompt F12 to see the return of redirect occurred.

problem solved

At first I thought it was a configuration problem Security, but try to try to have no effect, still not log on. After the toss for a long time to no avail, only to take into account the nginx, only it is not the same. According to security is to intercept url, is not in the reverse proxy when out of some tricky it?

Check in online in a circle, and sure enough problems on Nginx, modify Nginx configuration.

HTTP original configuration proxy_pass: // 127.0.0.1:8080

After the change the configuration HTTP proxy_pass: // 127.0.0.1:8080/

Plus a slash, the problem is solved.

conclusion of issue

Less a slash why would not it? The original problem is Nginx proxy path and project context-path mismatch caused. context-path = # Context path of the application. The application context path, the path may be referred to as a project, constituting a part of the url. In application.yml file for each module can be configured in server.servlet.context-path this property. If not configured, its default value is '' / '', which is why I am a slash Riga problem is solved in Nginx. the role of context-path with @RequestMapping similar, I understand @RequestMapping used to distinguish between Controller, and context-path main role is to distinguish between different modules, which is particularly important when using a reverse proxy, the reverse proxy servers need to distinguish between context-path in the end to identify which service to agents, if not, it will error.

========================================================================================

Do not simply collect learning materials, knowledge live in Baidu cloud or bookmark list of little significance.

His own confused place, really get to know, write it down. If someone else can understand, that is really mastered, stick to it, should be harvested.

========================================================================================

 

 

Guess you like

Origin www.cnblogs.com/hanstrovsky/p/11918890.html