Cross-domain create-react-app sets proxy proxy to report error 500Proxy error in package.json

this is how it is configured in package.json:

"proxy": {
    "/api": {
      "target": "https://xxxxxx",
      "changeOrigin": true,
      "secure": false
    }
  },

then it often appears to refresh the error 500, and there is no problem with the request from the server. Sometimes I can ask for success, sometimes I can ask for 500, and I don"t know what"s going on.
GET http://localhost:3000/api/xxxxxx 500 (Internal Server Error)

Proxy error: Could not proxy request / api/xxxxxx from localhost:3000 to https://xxxxxx.

seek advice from the great gods

Jul.08,2021

have you solved this problem? I have encountered the same problem. Can you share your solution


I have also encountered this problem. Excuse me, have you solved it?.


how did you solve it?


encountered the same problem, proxy agent failed [Proxy error: Could not proxy request / pq-web/login from localhost:8088 to http://xxxx.
See https://nodejs.org/api/errors. for more information (ENOTFOUND).]
scenario: every time mac starts the vue project and uses the corporate intranet outside the company, you need to connect to vpn, to configure DNS.
doubt: it is suspected to be DNS cache, but there is cleanup processing, but it is not resolved, and the exception will automatically disappear after about 10 minutes each time.


if you confirm that the service is normal and the agent is correct, you can take a look at the hosts configuration file. You need to add ip and domain name to resolve

correctly.
Menu