Commit 4600acfb authored by Per Buer's avatar Per Buer

Add a bunch of (?i) to get the message that the Host: header is case insensitive

parent 84b7dda8
......@@ -839,30 +839,36 @@ waiter
Purge expressions
-----------------
A purge expression consists of one or more conditions. A condition consists of a field, an operator, and an
argument. Conditions can be ANDed together with "&&".
A purge expression consists of one or more conditions. A condition
consists of a field, an operator, and an argument. Conditions can be
ANDed together with "&&".
A field can be any of the variables from VCL, for instance req.url, req.http.host or obj.set-cookie.
A field can be any of the variables from VCL, for instance req.url,
req.http.host or obj.set-cookie.
Operators are "==" for direct comparision, "~" for a regular expression match, and ">" or "<" for size compar‐
isons. Prepending an operator with "!" negates the expression.
Operators are "==" for direct comparision, "~" for a regular
expression match, and ">" or "<" for size comparisons. Prepending
an operator with "!" negates the expression.
The argument could be a quoted string, a regexp, or an integer. Integers can have "KB", "MB", "GB" or "TB"
appended for size related fields.
The argument could be a quoted string, a regexp, or an integer.
Integers can have "KB", "MB", "GB" or "TB" appended for size related
fields.
Simple example: All requests where req.url exactly matches the string /news are purged from the cache:::
Simple example: All requests where req.url exactly matches the string
/news are purged from the cache:::
req.url == "/news"
Example: Purge all documents where the name does not end with ".ogg", and where the size of the object is greater
than 10 megabytes:::
Example: Purge all documents where the name does not end with ".ogg",
and where the size of the object is greater than 10 megabytes:::
req.url !~ "\.ogg$" && obj.size > 10MB
Example: Purge all documents where the serving host is "example.com" or "www.example.com", and where the Set-
Cookie header received from the backend contains "USERID=1663":::
Example: Purge all documents where the serving host is "example.com"
or "www.example.com", and where the Set- Cookie header received from
the backend contains "USERID=1663":::
req.http.host ~ "^(www\.)example.com$" && obj.set-cookie ~ "USERID=1663"
req.http.host ~ "^(?i)(www\.)example.com$" && obj.set-cookie ~ "USERID=1663"
SEE ALSO
========
......
......@@ -92,7 +92,7 @@ A backend declaration creates and initializes a named backend object:::
The backend object can later be used to select a backend at request time:::
if (req.http.host ~ "^(www.)?example.com$") {
if (req.http.host ~ "(?i)^(www.)?example.com$") {
set req.backend = www;
}
......@@ -528,9 +528,9 @@ Example:::
# in file "backends.vcl"
sub vcl_recv {
if (req.http.host ~ "example.com") {
if (req.http.host ~ "(?i)example.com") {
set req.backend = foo;
} elsif (req.http.host ~ "example.org") {
} elsif (req.http.host ~ "(?i)example.org") {
set req.backend = bar;
}
}
......@@ -731,7 +731,7 @@ Values may be assigned to variables using the set keyword:::
sub vcl_recv {
# Normalize the Host: header
if (req.http.host ~ "^(www.)?example.com$") {
if (req.http.host ~ "(?i)^(www.)?example.com$") {
set req.http.host = "www.example.com";
}
}
......@@ -803,10 +803,10 @@ based on the request URL:::
}
sub vcl_recv {
if (req.http.host ~ "^(www.)?example.com$") {
if (req.http.host ~ "(?i)^(www.)?example.com$") {
set req.http.host = "www.example.com";
set req.backend = www;
} elsif (req.http.host ~ "^images.example.com$") {
} elsif (req.http.host ~ "(?i)^images.example.com$") {
set req.backend = images;
} else {
error 404 "Unknown virtual host";
......
......@@ -177,7 +177,7 @@ Varnish will cache different versions of every page for every
hostname. You can mitigate this in your web server configuration by
setting up redirects or by using the following VCL::
if (req.http.host ~ "^(www.)?varnish-?software.com") {
if (req.http.host ~ "(?i)^(www.)?varnish-?software.com") {
set req.http.host = "varnish-software.com";
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment