How does node forward the blocked interface?

" http://www.abc.com" is an address outside the wall with a ladder locally, so direct access is ok.

but during development, the node layer uses http-proxy-middleware as a proxy, for example:

app.use("/api/abc", proxy({
  target: "http://www.abc.com",
  pathRewrite: {
    "^/api/abc" : "",     // rewrite path
  },
}));
After the

agent, it is found that the interface can not be accessed, what should I do?

Mar.20,2021

the target parameter here should be the address of your proxy server, not the address you want to access. If it is shawodSockets, you should enter target:'127.0.0.1:1080'


.

combine your process


 |
nodejs
 |

 |
www.abc.com

all your nodejs needs to be forwarded to the ladder, not directly to www.abc.com, which is equivalent to no ladder

Menu