0

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.

2 Answers 2

3

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.

1
  • 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, 2013 at 15:44
1

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.

You must log in to answer this question.

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