preface

  • Online music poke me ah!
  • Music blog source code online!
  • To write a page, you need an interface.
  • Today, I wrote a cool graph with gusto. I was preparing the docking interface, but the interface replied that MY 403 permission was insufficient
  • Here’s a full overview of what happened.

Current problems?

I got a “403 permission deficiency” when I called the interface.

Let’s analyze why this problem exists.

Why does this happen?

IpB = 404; ipB = 404; ipB = 404;

To analyze this:

The good news is that 404 will not be returned. Verify that the interface is correct

The bad news is: go back to 403 and analyze the wave to see if nginx forwarded it incorrectly

Location/WCS /stu/ {proxy_pass http://47.44.20.200/; }Copy the code

Take it out/try it?

Namely: proxy_pass http://47.44.20.200

Success!

The solution

Remove the /.

The following code

Location/WCS /stu/ {proxy_pass http://47.44.20.200; }Copy the code

Catch up with knowledge

Nginx divides proxy_pass into two types

  • Uri-free: only IP and port number (/ after port)
    • Eg:proxy_pass http://localhost:8080
  • URI mode: there is another path after the port number
    • Eg: proxy_pass http://localhost:8080/abc

Chestnuts are as follows:

No URI: Nginx will keep the path part of location

location /api1/ { proxy_pass http://localhost:8080; When visit http://localhost/api1/xxx}, agent to http://localhost:8080/api1/xxxCopy the code

For urIs, nginx will replace urls with alternatives such as alias, and only literally

location /api2/ { proxy_pass http://localhost:8080/; } when visiting http://localhost/api2/xxx, http://localhost/api2/ (note that the final /) has been replaced by. http://localhost:8080/, then add the rest of the XXX, then turned to http://localhost:8080/xxxCopy the code

knowledge

Nginx

reference

Proxy_pass slash problem in Nginx

In the past to recommend

Vue-cli3 builds the component library

Vue implements dynamic routing (and the interviewer blows project highlights)

Axios manipulation in a project you didn’t know about (Core principles of handwriting, compatibility)

VuePress builds project component documentation

Vue koa2 + + nginx deployment

Vue-typescript-admin-template background management system

The original link

Juejin. Cn/post / 695418…