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

Christoph Eicke christoph at geisterstunde.org
Mon Dec 26 22:53:16 CET 2005


Hi Jespen,

(actually this message didn't go through and a reply has already been posted, 
but here is my 50cents for this anyways)

in section 5.2 of RFC2616 (http://www.w3.org/Protocols/rfc2616/rfc2616.html) 
is describes what has to be done:

"[...] An origin server that does differentiate resources based on the host 
requested (sometimes referred to as virtual hosts or vanity host names) MUST 
use the following rules for determining the requested resource on an HTTP/1.1 
request:

1. If Request-URI is an absoluteURI, the host is part of the Request-URI. Any 
Host header field value in the request MUST be ignored.

2. If the Request-URI is not an absoluteURI, and the request includes a Host 
header field, the host is determined by the Host header field value.

3. If the host as determined by rule 1 or 2 is not a valid host on the server, 
the response MUST be a 400 (Bad Request) error message.

Recipients of an HTTP/1.0 request that lacks a Host header field MAY attempt 
to use heuristics (e.g., examination of the URI path for something unique to 
a particular host) in order to determine what exact resource is being 
requested. [...]"

This means that the HTTP GET request has to look something like this:

GET /some/file.html HTTP/1.1
Host: www.your.virtual.host.com

I hope this helps.

Christoph

On Friday 23 December 2005 19:39, Jesper Hansen wrote:
> 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.
>
> Any hints as to how to solve this ?
>
>
> Merry Christmas and a Happy New Year !
>
> /Jesper
> _______________________________________________
> En-Nut-Discussion mailing list
> En-Nut-Discussion at egnite.de
> http://www.egnite.de/mailman/listinfo.cgi/en-nut-discussion

-- 
GPG Key ID: 33D6AA8C
AIM: zeitgeist2600
ICQ: 271512600
Jabber: zeitgeist at jabber.ccc.de
http://www.geisterstunde.org
http://www.ceicke.de



More information about the En-Nut-Discussion mailing list