How does it feel to use the http-proxy-middleware routing agent used by webpack-dev-server?

  1. my feeling when using axios url is that you cannot write an absolute path, otherwise your own proxy will not work, and it will still trigger cors
  2. . The router configuration in the
  3. proxy dynamically replaces the target according to the host in the request header to implement the proxy request. Multiple key-value pairs can be configured according to the official demo,router. When initiating a request from the client, the host is not single (if we visit an address and check the request header information, we will see that our host, is not the same website request header). Is it because I am using the wrong posture? Or does the website you visit include sub-sites, and then refer to the host of the sub-domain name?

clipboard.png

  1. itself proxy is implemented according to regular matching url, which means that the API design should be followed by a unified prefix. If multiple modules are distributed in multiple projects, the url prefix should be designed differently, or you may manually add the prefix when accessing the API of different modules at the front end, so as to let the url enter the corresponding proxy, which rewrites the url according to the pathRewrite to achieve the proxy function
  2. .
  3. do you think this is acceptable? smile manually
Menu