Is there a way to replace 127.0.0.1 on my local computer for testing?

I know this may sound silly, but anyway. Maybe there is a trick?

I just want the local web server to receive requests from my local computer, but somehow sees a different IP address? Even one single, different from the notorious 127.0.0.1, could be of great help.

Are there any options?

+4
source share
5 answers

Try 127.0.0.2 or 127.0.0.3 ... or ...

Seriously, try it!

Depending on your operating system, localhost can be reached across the entire network 127.0.0.0/8 , so even 127.42.37.254 will reach localhost (this is done on my Ubuntu machine).

+5
source

Or put the entry in your HOSTS file for anything by pointing to localhost.

+4
source

Are you accessing the local web server through 127.0.0.1? If so, what if you are using the actual IP address of your computer? The request will still end on your local web server, but maybe he will see it as a sender instead of 127.0.0.1.

+2
source

You can use your public IP address .

0
source

You can always configure the web server to listen on your IP address on the network, and then use this ip.

On the other hand, if you want to receive requests from several domains, such as a.localhost, b.localhost and c.localhost, try editing your hosts file to redirect domains to 127.0.0.1

0
source

All Articles