Problem description
After the introduction of spring security, there is no problem using Vue proxy locally. There is a problem using nginx. The problem is located in the nginx configuration
Solution:
# rewrite ^(/api/?.*)$ /$1 break; // old
rewrite ^/api/(.*)$ /$1 break; // modified
Explanation
take blog.lhuakai.top/api/getxxx
as an example
nginx
found /API
, replaced the match to /api.getxxx/
with $1 (the content in the first group) getxxx
and finally became blog.lhuakai.top/getxxx