Configuration question about a domain list for a http.req.host comparaison
Damien Desmarets
list at zaide.org
Mon Feb 9 18:51:45 CET 2009
Hello,
I have 1 question for you. I haven't found the response in the
documentation/wiki. I think you have a big job to wrtie a good
documentation ... the current is really poor !
So the question.
I have a list of differents domains:
azeazeaze.com
eruigeiogr.com
zezeirjiorf.com
...
My configuration file is actually like this:
if (req.http.host ~
"^(azeazeaze.com|eruigeiogr.com|zezeirjiorf.com|...)$") {
set req.backend = principal_delivery;
} elsif (req.http.host ~
"^(aazeazeazeaze.com|azeiazjeaioze.com|azejoazjeaiozejoaz.com|...)$") {
set req.backend = pictures_delivery;
} else {
error 403 "Not supported"
}
The regex comparison is very big with maybe 100 domains. It's not clear
inside my file, and difficult to made change.
Is it possible to include those domains in a list and match this list to
the req.http.host. Like this maybe:
#define DOMAINS_PRINCIPAL_LIST "domains_principal_list.txt"
#define DOMAINS_PICTURES_LIST "domains_pictures_list.txt"
if (req.http.host ~ DOMAINS_PINCIPAL_LIST) {
set req.backend = principal_delivery;
} elsif (req.http.host ~ DOMAINS_PICTURES_LIST) {
set req.backend = pictures_delivery;
} else {
error 403 "Not supported"
}
I know the constant don't contain regex valid content but it's a
pseudo-code to show you the idea.
And my file "domains_principal_list.txt" contains for exemple:
azeazeaze.com
eruigeiogr.com
zezeirjiorf.com
Is it possible to do this in VCL origin configuration?
Thank for your help.
Regards,
Damien Desmarets
More information about the varnish-misc
mailing list