/ Zope / Apsis / Pound Mailing List / Archive / 2007 / 2007-09 / Multiple HeadRequire in one service

[ << ] [ >> ]

[ possible minor pug in pound/poundctl / Alex ... ] [ How can pound handle the new certs with local CA? ... ]

Multiple HeadRequire in one service
"Nigel Rausch" <nigel.bris(at)gmail.com>
2007-09-27 14:38:38 [ FULL ]
Hi,

Is there a way to put multiple hosts into one service definition eg.

            Service
                HeadRequire "Host: .*www.server1.com.*"
                HeadRequire "Host: .*www.somethingelse.com.*"


                BackEnd
                    Address 192.168.0.11
                    Port    80
                End
            End

Thanks.....
Attachments:  
text.html text/html 469 Bytes

Re: [Pound Mailing List] Multiple HeadRequire in one service
Russell Odom <listsignups(at)zolv.com>
2007-09-27 15:15:42 [ FULL ]
Nigel Rausch wrote:[...]

Use a regular expression, like this:

HeadRequire "Host: .*www\.(server1|somethingelse)\.com.*"

Regards,

Russ
[...]

Re: [Pound Mailing List] Multiple HeadRequire in one service
Dave Steinberg <dave(at)redterror.net>
2007-09-27 15:28:29 [ FULL ]
Nigel Bausch wrote:[...]

HeadRequire "Host: .*www\.(server1|somethingelse)\.com.*"

Regards,[...]

Re: [Pound Mailing List] Multiple HeadRequire in one service
Bob Apthorpe <apthorpe(at)cynistar.net>
2007-09-27 17:19:14 [ FULL ]
Dave Steinberg wrote:[...][...][...]

Additionally, if you have the perl module Regexp::Assemble installed,
you can use this to generate the HeadRequire line:

#!/usr/bin/perl
use warnings;
use strict;
use Regexp::Assemble;

my (at)rawhosts = (at)ARGV;
chomp (at)rawhosts;
my (at)hosts = ();
for my $h ((at)rawhosts) {
    $h =~ s/\./\\./g;
    push (at)hosts, $h;
}
my $ra     = Regexp::Assemble->new->add((at)hosts);
my $header = qq{    HeadRequire "Host: .*} . $ra->re . qq{.*"\n};

# hack: what's the right way to turn off perl's regex flags like '?-xism:'
$header =~ s/\?[^:]*://go;
print $header;
exit 0;

Example:

$ make_hostheader.pl www.server1.com www.somethingelse.com
    HeadRequire "Host: .*(www\.s(omethingelse|erver1)\.com).*"

hth,
[...]

Re: [Pound Mailing List] Multiple HeadRequire in one service
"Nigel Rausch" <nigel.bris(at)gmail.com>
2007-09-28 12:43:40 [ FULL ]
Sorry to be a real nube...

so if I had two domains of
track.server1.com.au
red.somethingelse.com

ie a .com and .com.au

what would be the value I would use then...

Thanks again....

On 9/27/07, Dave Steinberg <dave(at)redterror.net> wrote:[...]
Attachments:  
text.html text/html 1638 Bytes

Re: [Pound Mailing List] Multiple HeadRequire in one service
Russell Odom <listsignups(at)zolv.com>
2007-09-28 13:15:55 [ FULL ]
Nigel Rausch wrote:[...]

HeadRequire "Host: .*(track.server1.com.au|red.somethingelse.com).*"

Have a read up on regular expressions, and it'll make more sense!

Regards,

Russ
[...]

Re: [Pound Mailing List] Multiple HeadRequire in one service
"Nigel Rausch" <nigel.bris(at)gmail.com>
2007-09-28 14:59:48 [ FULL ]
that works great, thank you!

Also thanks for the tip...

On 9/28/07, Russell Odom <listsignups(at)zolv.com> wrote:[...]
Attachments:  
text.html text/html 1205 Bytes

MailBoxer