Share this article
Improve this guide
How to Fix Error Occurred while Trying to Proxy Request
Give a try to these quick methods now
3 min. read
Updated onFebruary 26, 2024
updated onFebruary 26, 2024
Share this article
Improve this guide
Read our disclosure page to find out how can you help Windows Report sustain the editorial teamRead more
Key notes
If you’re a developer, you might have encountered anErroroccurred while trying to proxy requestmessage on your PC.
Thiserrorcan 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.
World-class 24/7 support with 83% for a 3 years plan and 3 months free.
Amazing connection speed with 35% off and 3 months free for the 1-year plan.
Best security protocols with 83% off and 2 months free for a 2-year plan.
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 theserverwas using IPV6 while theproxyused 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 thechangeOriginsetting fixed the problem, so be sure to try that.
3. Change web pack 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 removingexpress body-parser middlewarebefore 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”
},
}));
};
Erroroccurred while trying to proxy requestmessage can cause a lot of trouble, and we covered a similar error in ourGraphQL unauthorized errorguide, so visit it for more information.
If you’re having additional problems with Webpack, we also have a guide onField browser doesn’t contain a valid alias configurationerror, so don’t miss it.
Also if you’re having problems with proxy, ourERR_PROXY_CONNECTION_FAILEDguide should be able to help you fix it.
More about the topics:proxy server
Milan Stanojevic
Windows Toubleshooting Expert
Milan has been enthusiastic about technology ever since his childhood days, and this led him to take interest in all PC-related technologies. He’s a PC enthusiast and he spends most of his time learning about computers and technology.
Before joining WindowsReport, he worked as a front-end web developer. Now, he’s one of the Troubleshooting experts in our worldwide team, specializing in Windows errors & software issues.
User forum
0 messages
Sort by:LatestOldestMost Votes
Comment*
Name*
Email*
Commenting as.Not you?
Save information for future comments
Comment
Δ
Milan Stanojevic
Windows Toubleshooting Expert
Before joining WindowsReport, he worked as a front-end web developer. Now, he’s specialized in Windows errors & software issues.