9

This question is not a duplicate because the suggested duplicate does not solve this problem. There is no such flag on chrome://flags/.

I'm using the Google Chrome web browser and WampServer to locally host a website. When I try to see my website on the localhost address in Chrome I'm getting the error ERR_CONNECTION_REFUSED. When I type the IP address 127.0.0.1 instead, the result stays the same.

On the other hand, if I enter localhost into the address bar on Internet Explorer I'm getting the expected result: The webpage displayed.

How do I make Chrome's localhost work? It may be some sort of security measure but to me it's rather an annoyance than anything else.

8
  • 1
    What happens when you type http://127.0.0.1/ on both, and when you type http://[::1]/ on both? Commented Aug 23, 2015 at 13:54
  • @grawity Yes, both surprisingly work in Chrome and also on Internet Explorer. It seems like Chrome tries to do https://localhost/ but can't because a secure connection is not available. Commented Aug 23, 2015 at 13:56
  • 3
    possible duplicate of Google Chrome can't access localhost domains
    – RiggsFolly
    Commented Aug 24, 2015 at 22:48
  • 2
    @RiggsFolly The given solution does not solve the problem though Commented Aug 25, 2015 at 11:56
  • Google for Chrome and localhost Chrome has a few odd issues with localhost for some unknown reason. There are a few possible solutions, depending on your version and how many times the issue has been fixed and then re-occured.
    – RiggsFolly
    Commented Aug 25, 2015 at 12:05

2 Answers 2

0

For me, it usually worked after a reboot .. or several, but finally took some time to look up the possible reasons. These are what I encountered - using Mac OSX.

1) Domain name - localhost is common and a must working name, I personally used .dev domains until it became a top-level domain with forced https If you're using a local domain, make sure the DNS is pointing to the localhost address (127.0.0.1). You can open a terminal and run:

ping mydomain.unnamed If not working then check your hosts file.

2) Apache syntax errors - Run httpd -t to check syntax, also make sure you do have the domain showing up in vhosts httpd -t -D DUMP_VHOSTS

3) Apache port 80 or 443 blocked - Either by firewall or other applications, so check ports:

lsof -i:80 with kill -9 (lsof -ti:80),also restart the apache service.

4) Invalid SSL certificate - For https localhost domains, renew certificates or re-add them to the Keychain.

5) Less common - Chrome extension that controls networking and probably forgotten about setting it, disable it and test.

-1

Open command prompt as Administrator and type these two commands one by one:

netsh advfirewall firewall add rule name="TCP Port 80" dir=in action=allow protocol=TCP localport=80
netsh advfirewall firewall add rule name="TCP Port 80" dir=out action=allow protocol=TCP localport=80

After doing so, restart the Wamp server and try to access http://localhost. If that fails, try one of these links:

  • http://127.0.0.1:80
  • http://127.0.0.1:8080
  • http://127.0.0.1:443
  • http://127.0.0.1:4443

Good luck!

1
  • Don't run unexplained commands haphazardly on you PC. At least check if these rules need to be added first
    – Zach Smith
    Commented Aug 20, 2020 at 7:17

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .