Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
U
unique-xids
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
uplex-varnish
unique-xids
Commits
4600acfb
Commit
4600acfb
authored
Feb 17, 2011
by
Per Buer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add a bunch of (?i) to get the message that the Host: header is case insensitive
parent
84b7dda8
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
20 deletions
+26
-20
varnishd.rst
doc/sphinx/reference/varnishd.rst
+19
-13
vcl.rst
doc/sphinx/reference/vcl.rst
+6
-6
increasing_your_hitrate.rst
doc/sphinx/tutorial/increasing_your_hitrate.rst
+1
-1
No files found.
doc/sphinx/reference/varnishd.rst
View file @
4600acfb
...
@@ -839,30 +839,36 @@ waiter
...
@@ -839,30 +839,36 @@ waiter
Purge expressions
Purge expressions
-----------------
-----------------
A purge expression consists of one or more conditions. A condition consists of a field, an operator, and an
A purge expression consists of one or more conditions. A condition
argument. Conditions can be ANDed together with "&&".
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‐
Operators are "==" for direct comparision, "~" for a regular
isons. Prepending an operator with "!" negates the expression.
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"
The argument could be a quoted string, a regexp, or an integer.
appended for size related fields.
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"
req.url == "/news"
Example: Purge all documents where the name does not end with ".ogg",
and where the size of the object is greater
Example: Purge all documents where the name does not end with ".ogg",
than 10 megabytes:::
and where the size of the object is greater
than 10 megabytes:::
req.url !~ "\.ogg$" && obj.size > 10MB
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-
Example: Purge all documents where the serving host is "example.com"
Cookie header received from the backend contains "USERID=1663":::
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
SEE ALSO
========
========
...
...
doc/sphinx/reference/vcl.rst
View file @
4600acfb
...
@@ -92,7 +92,7 @@ A backend declaration creates and initializes a named backend object:::
...
@@ -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:::
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;
set req.backend = www;
}
}
...
@@ -528,9 +528,9 @@ Example:::
...
@@ -528,9 +528,9 @@ Example:::
# in file "backends.vcl"
# in file "backends.vcl"
sub vcl_recv {
sub vcl_recv {
if (req.http.host ~ "example.com") {
if (req.http.host ~ "
(?i)
example.com") {
set req.backend = foo;
set req.backend = foo;
} elsif (req.http.host ~ "example.org") {
} elsif (req.http.host ~ "
(?i)
example.org") {
set req.backend = bar;
set req.backend = bar;
}
}
}
}
...
@@ -731,7 +731,7 @@ Values may be assigned to variables using the set keyword:::
...
@@ -731,7 +731,7 @@ Values may be assigned to variables using the set keyword:::
sub vcl_recv {
sub vcl_recv {
# Normalize the Host: header
# 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";
set req.http.host = "www.example.com";
}
}
}
}
...
@@ -803,10 +803,10 @@ based on the request URL:::
...
@@ -803,10 +803,10 @@ based on the request URL:::
}
}
sub vcl_recv {
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.http.host = "www.example.com";
set req.backend = www;
set req.backend = www;
} elsif (req.http.host ~ "^images.example.com$") {
} elsif (req.http.host ~ "
(?i)
^images.example.com$") {
set req.backend = images;
set req.backend = images;
} else {
} else {
error 404 "Unknown virtual host";
error 404 "Unknown virtual host";
...
...
doc/sphinx/tutorial/increasing_your_hitrate.rst
View file @
4600acfb
...
@@ -177,7 +177,7 @@ Varnish will cache different versions of every page for every
...
@@ -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
hostname. You can mitigate this in your web server configuration by
setting up redirects or by using the following VCL::
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";
set req.http.host = "varnish-software.com";
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment