Run the project and report an error proxy error: could not proxy request...

I encountered a problem when I was running the project today. It was fine when I ran it in the morning. When I got up after lunch break, I saw an error on the page.

The pop-up window prompts: proxy error: could not proxy request...from my local to the target address.

The terminal reports an error:

Proxy error: Could not proxy request interface url from my local to target server

Page performance: the page can be opened, and the UI can also be displayed, but the interfaces are all red, and 500 is reported

The backend service is started normally, and I have not made any changes to the proxy configuration locally. Therefore, the fluctuation caused by the back-end service or the reason for locally modifying the proxy configuration is excluded.

After checking, it may be caused by port number conflict, so I tried to modify the local port number, and then re-run the project, the problem is solved!

dev: {     publicPath: '/',     host: '127.0.0.1', // local server     port: '3333', // (modification point) local default port, just run again after modification     proxy: { // proxy Configuration         '/api': {           target: 'proxy target address',           changeOrigin: true,           ...         }     } }










That's right, it was caused by a port number conflict. I started multiple front-end projects and they used one port.

Solution:

Method 1. Modify the port number of one of the front-ends   

Method 2. Close one of the front-end projects


Reference link:

https://blog.csdn.net/m0_64398772/article/details/124800036

Guess you like

Origin blog.csdn.net/YuDBL/article/details/127684767