question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[HPM] Error occurred while trying to proxy request / from localhost:3000 to http://localhost:8080 on fresh Debian Stretch 4.8.0 install

See original GitHub issue

When running npm run dev after npm install I expect to navigate to localhost:3000 and see the starter page, instead I see Error occured while trying to proxy to: localhost:3000/ and in logs

10:44:07 PM webpack.1 |  [HPM] Error occurred while trying to proxy request /favicon.ico from localhost:3000 to http://localhost:8080 (ECONNREFUSED) (https:
10:44:07 PM webpack.1 |  >  //nodejs.org/api/errors.html#errors_common_system_errors)

Issue Analytics

  • State:open
  • Created 7 years ago
  • Comments:45 (1 by maintainers)

github_iconTop GitHub Comments

166reactions
jellyfish-tomcommented, Jul 21, 2017

@saikat no necesarilly, it s just common bug in error log. I tried to proxy from 9000, to 8081 and saw the same error saying it can not proxy to 9000… makes no sense.

You probably need to rewrite your webpack proxy config:

replace localhost with [::1]. like so: ‘http://[::1]:3000’

this works for me:

below code comes from webpack configuration file - section devSever (as seen below) https://webpack.github.io/docs/webpack-dev-server.html#proxy

devServer: {
  proxy: {
    "*": "http://[::1]:8081"
    // "secure": false,
    // "changeOrigin": true
  }
},

one wildcard, or double, with ‘secure’ or ‘changeOrigin’ - doesnt matter. [::1] is the game changer.

Wider discussion and more options here: https://github.com/webpack/webpack-dev-server/issues/793

Good luck!

126reactions
RobertPal95commented, Jul 19, 2018

For me the problem was the HTTPS, not HTTP, and worked with changeOrigin, solve it like this:

{ “/api”: { “target”: “https://localhost:12345”, “secure”: false, “changeOrigin”: true } }

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error [HPM] Error occurred while trying to proxy request / from ...
First, your developMiddleware setup points to http://localhost:4000 , but your server ( server.js ) by default runs at http://localhost:3000 .
Read more >
How to fix error occurred while trying to proxy request
1. Check which IP version is the server using · 2. Modify your code · 3. Change webpack proxy configuration · 4. Modify...
Read more >
Fix Error Occurred While Trying to Proxy Request - TechCult
An error occurred while typing to proxy request is a common error that developers come across while writing and publishing codes.
Read more >
Django : React Proxy error: Could not proxy request /api
Django : React Proxy error : Could not proxy request /api/ from localhost:3000 to http://localhost:8000 (ECONNREFUSED) [ Beautify Your ...
Read more >
Sage 10 Proxy Localhost:3000 Not Working - Roots Discourse
Hello, I am running a new installation of Trellis on Ubuntu 20.10 and and am ... Visiting localhost:3000 results in: Error occurred while...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found