PATCH: vhost module doesn't work when not on port 80

Martin Atkins mart at degeneration.co.uk
Wed Aug 17 13:57:49 PDT 2005


While playing around with perlbal I've got it running on a nonstandard
port. I found that since the Host header contains a port number the
vhost module fails to match to the right vhost.

I think the easiest fix is just to strip the port off completely, and
the simple patch I've attached does that very thing. There seems little
point in using the client-supplied port number when there's a real port
number available on the socket itself.

-------------- next part --------------
--- lib/Perlbal/Plugin/Vhosts.pm	2005-08-17 21:49:12.000000000 +0100
+++ lib/Perlbal/Plugin/Vhosts.pm	2005-08-17 21:50:04.000000000 +0100
@@ -84,6 +84,9 @@
 
     my $vhost = $req->header("Host");
 
+    # Strip off the :portnumber, if any
+    $vhost =~ s/:.*$//;
+
     my $maps = $cb->{service}{extra_config}{_vhosts} ||= {};
 
     # returns 1 if done with client, 0 if no action taken


More information about the perlbal mailing list