WAMP localhost redirects to my IP

haakym

I had to recently wipe my PC and I'm setting up my development environment again using WAMP.

After installing WAMP, if I visit http://localhost instead of seeing the WAMP homepage I get redirected to http://x.x.x.x, where x.x.x.x is my IP.

I had this issue on another PC and after setting the inbound rules for Apache HTTP Server in my Windows Firewall settings to allow all domains it fixed the issue. I applied this to my PC, and the issue does not seem to be present for Internet Explorer, whereas for Chrome and Firefox the localhost to my IP redirect issue persists even after clearing the cache for each browser.

My C:\Windows\System32\drivers\etc\hosts file looks like this:

127.0.0.1       localhost
::1             localhost

and my firewall rules look like this:

enter image description here

I am not currently using vhosts and I'm on a network at my workplace (if that has any implications?)

I also encountered the same issue when using Laragon which uses vhosts and whenever I visited a virtual host, e.g. mysite.dev it didn't work properly either.

My question on the Laragon forum: https://forum.laragon.org/topic/126/accessing-mysite-dev-redirects-to-url-which-shows-index-php-at-root-folder/3

haakym

The Problem

I'm behind a proxy which is used for browsing the web at my workplace. The proxy seemed to be messing up the dns resolution whenever I made a call to localhost (when using wamp) or one of my vhosts (when using Laragon).

This was clear as when I ran the following from the command line: ping site.dev I was getting the expected response from 127.0.0.1. However, when going to site.dev in my browser I was getting redirected to my IP, so essentially my etc/hosts file was being ignored for dns resolution.

The difference between the two being that the browser is using the proxy whereas the command line isn't!

The Solution

After trying many different solutions which seemed to work for localhost (on wamp) only, but not vhosts (on Laragon) I finally got to the solution which was actually so simple!

So, for chrome I simply went to chrome://settings/ > Network - Change proxy settings > LAN Settings > Proxy Server - Advanced

Then in the Exceptions text box I added the following:

*.dev;localhost;127.0.0.1

Here's a screenshot of my settings from Chrome/Internet Options

enter image description here

And that did the trick! Hope this can help someone else.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

WAMP Server redirects to localhost from ip address

Wamp - access project via IP instead of localhost

Cant access wamp server(localhost) for my social android app?

Will deleting temporary files in wamp speed up my localhost server?

How to navigate out of my php localhost server project (wamp server)?

Why error.com redirect me to my wamp server localhost?

WAMP my own internal ip doesn't work on browser

Weird WAMP localhost error

localhost redirects to a different page

Firefox redirects localhost to HTTPS

My localhost doesn't see my html and php files from www on Windows 10 (wamp)

How can I modify my IP address on my localhost in MAMP?

Issue with root localhost directory wamp

Jsfiddle code not working in localhost wamp

.google domain name redirects to localhost

Connecting to localhost redirects through proxy

Microsoft Edge redirects http://localhost to https://localhost

Can telnet to localhost but cannot telnet to my LAN IP

Forwarding <my ip>:<port> to localhost:80/dir/ (apache)

XHR works on localhost server but not on my static IP on IIS

Is there a way to start a Zookeeper server using my static ip instead of localhost

Can access my server by localhost but not by ip from the same computer

Why does JBoss 7.1.1 recognize localhost but not my IP address?

I am not able to access my Wordpress site in remote WAMP server because my IP address has been changed

WAMP: Missing http://localhost/ in urls , wrong wamp projects links

How can i make a node.js server to listen to my ip on my lan instead of localhost

Why is TypeORM DataSource initialization seemingly setting my host to localhost instead of my public IP?

Can't access localhost with wamp and Chrome

How to modify web address in localhost using wamp?