when parsing the vhosts from /sys/lib/rewrite the parser discards the port such that http://foo/ and http://foo:1080/ are treated as the same vhost. when parsing the http request, httplib takes the Host: header and passes it (correctly) as the vhost. a Host: with a :port will never match a vhost. The correct behaviour should be to treat the host's individually and require multiple entries in /sys/lib/rewrite if two vhosts on the different ports want to share namespaces. this patch just removes the ":" from the tokenizer of the vhost parser. I've been running the patched httpd here since the day I supplied the patch. If you want to verify the correctness the explanation of the Host: header is in section 14.23 of http://www.faqs.org/rfcs/rfc2616.html Reference: /n/sources/patch/applied/httpd-host-port Date: Wed Sep 26 21:19:54 CES 2007 Signed-off-by: matt@proweb.co.uk --- /sys/src/cmd/ip/httpd/redirect.c Thu Sep 13 23:43:13 2007 +++ /sys/src/cmd/ip/httpd/redirect.c Thu Sep 13 23:43:10 2007 @@ -94,9 +94,10 @@ if(strncmp(field[0], "http://", STRLEN("http://")) == 0 && strncmp(field[1], "http://", STRLEN("http://")) != 0){ host = field[0]+STRLEN("http://"); - s = strpbrk(host, "/:"); + s = strpbrk(host, "/"); if(s) - *s = 0; /* chop trailing slash or portnumber */ + *s = 0; /* chop trailing slash */ + insert(vhosttab, estrdup(host), estrdup(field[1])); }else{ insert(redirtab, estrdup(field[0]), estrdup(field[1]));