This error can cause a lot of problems for some users, but today we want to show you a couple of solutions that might help you fix this issue once and for all.

How can I fix Error occurred while trying to proxy request?

1. Check which IP version is the server using

Users reported this error message because the server was using IPV6 while the proxy used IPV4, but after changing that, the issue was completely resolved.

2. Modify your code

{ “/api”: { “target”: “https://localhost:12345”, “secure”: false, “changeOrigin”: true } } Users reported that adding the changeOrigin setting fixed the problem, so be sure to try that.

3. Change webpack proxy configuration

devServer: {   proxy: {     “*”: “http://[::1]:8081”     // “secure”: false,     // “changeOrigin”: true   } }, According to users, it’s crucial that you add [::1] in order to fix this problem, so be sure to try that.

4. Modify the hosts file

5. Remove body-parser

Many users reported that they fixed this issue simply by removing express body-parser middleware before HPM. After doing that, the issue was completely resolved, so be sure to try that.

6. Add a header in the client proxy

module.exports = function(app) {     app.use(proxy(’/api’, {         target: ‘http://127.0.0.1:8080/’,         headers: {             “Connection”: “keep-alive”         },     })); }; Error occurred while trying to proxy request message can cause a lot of trouble, but hopefully, you should be able to fix it using one of our solutions.

Name * Email * Commenting as . Not you? Save information for future comments
Comment

Δ