Nginx settings reverse generation, 404, can ensure that the configuration is not a problem, can ensure that the interface is not a problem, so it is very fascinating

upload file API, cross-domain, and then reverse through Nginx. The configuration is as follows:

 location /aaa/ {
     proxy_pass http://www.xxx.com:8887/aaa/api/device/upload;
}
  1. Test: proxy_pass http://bing.com; can see the Bing page, so the configuration is fine.
  2. Open the http://www.xxx.com:8887/aaa/api/device/upload backend brother on the website where the console can see the request (500,404). so the interface is fine.

(in addition, different ports on the same server)

then I was fascinated and didn"t know what the problem was.
if you want some help, thank you in advance.

Jul.06,2021

the first type:

  • Nginx configuration location / aaa/ {proxy_pass http://www.xxx.com:8887;}
  • frontend access http://www.xxx.com/aaa/api/device/upload

second type:

  • Nginx configuration keeps the title unchanged
  • frontend access http://www.xxx.com/aaa (do not add the following string)

add nginx errorlog to the http://www.xxx.com:8887/aaa/api/device/upload; site, see errorlog ah, and see where the visit has gone


your path should be automatically added / aaa, try adding "/" at the end of the link, focusing on the slash at the end of the url:

 location /aaa/ {
     proxy_pass http://www.xxx.com:8887/aaa/api/device/upload/;
}

type the errorlog first, and you'll know what's wrong

.
Menu