cors-anywhere icon indicating copy to clipboard operation
cors-anywhere copied to clipboard

Error: connect ECONNREFUSED

Open blumonkey opened this issue 9 years ago • 9 comments

Hi, I am trying to setup the CORS-Anywhere server and am facing this problem whenever I try to access a URL

//URL: http://localhost:1337/google.com (I use 8080 for tomcat)
Not found because of proxy error: Error: connect ECONNREFUSED

At first I got the Missing headers message, I tried 2 things:

  • Remove the requireHeader option (ie set it to null)
  • Left the recommended requireHeader as-is and added them in the createServer function

Both of them give the same error as shown above. Any help is appreciated. Thanks.

blumonkey avatar Jun 27 '15 18:06 blumonkey

Is the network connection and DNS correctly configured on your server?

Rob--W avatar Jun 27 '15 18:06 Rob--W

What would be the correct configuration? BTW I forgot to mention, I myself am behind a proxy. Hope it helps.

blumonkey avatar Jun 27 '15 18:06 blumonkey

Depends on your Operating system. If this issue is caused by an incorrect DNS/network/firewall config, then the problem has nothing to do with this library. Any (Node.is) application would experience this issue. On Jun 27, 2015 8:46 PM, "blumonkey" [email protected] wrote:

What would be the correct configuration?

— Reply to this email directly or view it on GitHub https://github.com/Rob--W/cors-anywhere/issues/29#issuecomment-116116436 .

Rob--W avatar Jun 27 '15 19:06 Rob--W

How do I set it right? I am running Ubuntu 14.04_x64.

blumonkey avatar Jun 28 '15 08:06 blumonkey

Look in /etc/resolv.conf, and ensure that nameservers are being specified. E.g. using Google's DNS servers:

nameserver 8.8.8.8
nameserver 8.8.4.4

Rob--W avatar Jun 28 '15 19:06 Rob--W

Mine has a nameserver 127.0.1.1. Anyways I believe it was the proxy that was giving the issue, I have implemented a simple http-server which just writes the content of a webpage to the reponse but it also returned the same error. I have followed this blog to configure the http modules for usage behind proxy: http://blog.shaunxu.me/archive/2013/09/05/semi-global-proxy-setting-for-node.js.aspx

I didn't try this yet on cors-anywhere but I hope it will work.

Perhaps you(or I ;)) can add this as an enhancement -- Proxy-support. IDK, Just saying :)

blumonkey avatar Jun 28 '15 20:06 blumonkey