[En-Nut-Discussion] How to connecto to a virtual host

Pavel Chromy chromy at asix.cz
Sun Dec 25 12:45:52 CET 2005


Jesper Hansen napsal(a):

> I was trying to download a file using HTTP from my Linux machine, which 
> has a number of domains on it.
> 
> I used NutDnsGetHostByName to pick up the IP which worked fine, then 
> used a "GET /myfile.ext HTTP/1.0" e.t.c. to get the file.
> 
> It obviously didn't work, because the IP returned by NutDnsGetHostByName 
>  will just point to the default Apache page on the Linux machine and not 
> to the one at my virtual domain on that machine, which I would normally 
> reach with "www.domain.com" in a browser.

Hi, Jesper!

Sure, it cannot work this way as all virtual hosts resolve to the same 
IP address. You have to use HTTP 1.1 and a Host header. Try sending 
Host: wanted.virtualhost.net\n" first and then "GET /myfile.ext HTTP/1.1\n".

Hope this helps

Pavel



More information about the En-Nut-Discussion mailing list