Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I have a virtual machine image (using Virtual PC) of Windows XP/IE6 from Microsoft's "modern IE" website. This virtual machine is hosted by a Windows 7 machine.

I have a local web application on the host machine and need to check it in IE6 (sadly). Inside the virtual machine, can the "localhost" name be mapped to point to the IP of the host machine? I tried editing the c:/windows/system32/drivers/etc/hosts file in the virtual machine to [IP address of host machine] localhost but that doesn't work. The reason I want to use "localhost" rather than an IP is because some of the web application's configuration files point to "localhost."

I can change the configuration files to point to a different domain name, but I wanted to know if the "localhost" name itself can point to something else. I get the feeling that "localhost" is some type of reserved keyword that only points to 127.0.0.1.

share|improve this question

2 Answers 2

up vote 3 down vote accepted

No, you cannot do that.

RFC 2606, defining the "reserved TLDs" specifically prohibit it so pretty much all TCP/IP stack will always statically bind "localhost" to the local loopback address (127.0.0.1)

If you're using IIS as a web server, you can use application request routing to create a "proxy" rule that will then fe6tch that document from another host.

share|improve this answer
    
I'm using Apache, so I can't use the IIS proxy trick. I didn't realize that the RFC prohibited this, but that is good to know. I'll just point to another domain instead and modify my local configuration files to point to the new domain. –  Stephen Jul 29 '13 at 15:44

If you want to access the web application on the host from guest using the name localhost you can use some kind of reverse proxy. The proxy would be installed on the guest machine.

Your web browser running on the guest will connect to the reverse proxy running on the guest too so it can use the standard localhost name pointing to 127.0.0.1. The reverse proxy will then make a connection to the real web server running on the host machine.

  1. The mentioned Application Request Routing is one example which runs on IIS but it seems that only IIS 7 and newer is supported. As you run the web server on the host it does not matter which server you run on the guest.
  2. Apache can be configured as a reverse proxy..
  3. Squid can act as a reverse proxy too.
  4. There is also for example Proxyma.
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.