views:

142

answers:

5
+1  Q: 

HTTP Header

I am using a virtual host, so I have a shared IP address. I would like to access my test site by sending the hostname http header to the IP address, so the server can resolve the name and send back my site page. I am using an unregistered domain name on the server so I can't just type the url into the browser. Does anyone know the easiest way to set an HTTP header and send it to an IP address?

Thanks

+7  A: 

add the ip and hostname to you hosts file

# Example
88.99.100.1       yourwebsitename.com

http://en.wikipedia.org/wiki/Hosts_file

Josh
A: 

Add an alternative IP address to the network card on the host, and use this IP address for the web server. Alternatively, you can set the IP addres in the virtual machine and use that.

As another alternative - have a sys admin update your DNS server; add aliases for your web server and set up your headers to handle these requests, assuming you're using IIS. I'm not sure hw to do this on other web servers.

To update DNS settings, on a domain controller go to the DNS management console and browse to the appropriate domain in the forward lookup zone. Add a new alias and point it at the web server. The alias may be something like MyWebApp.MyDomain.Local, and point at MyWebServer.MyDomain.Local.

If this sounds like a suitable way to do things, let me know and I'll add some more detail on how to do this.

Which might not be answering the question asked... :-\

Hooloovoo
I think when he said "virtual host" he meant shared hosting for a website, not a virtual host in the virtualization sense.
Eric Petroelje
Adding an IP address to the server instance will still work. I jsut had a better idea of how to do this.
Hooloovoo
+1  A: 

From a command prompt:

telnet 127.0.0.1 80
GET / HTTP/1.1
Host: example.com

Replacing the ip address and host name with the ones you care about.

David Dorward
A: 

Not answering the question directly, but to test virtual hosts before the DNS entry has propagated in the past I've added an entry to my local hosts file. This usually resides in /etc/hosts on GNU/Linux and similar and %WINDIR%\system32\drivers\etc\hosts on Windows.

Existing entries should give you an idea of what to add to it.

John Barrett
A: 

You can also use the DynDNS service, register a subdomain (like mywebsites.homedns.org) for free and enable wildcard subsub-domains. Then you can add foo.mywebsites.homedns.org to the vhost ServerAlias and go to http://foo.mywebsites.homedns.org.

MSpreij