Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
varnish-cache
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
varnishcache
varnish-cache
Commits
56cfc908
Commit
56cfc908
authored
Mar 29, 2012
by
Per Buer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
alternative, simpler cookie stripper by James Light
parent
70468df3
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
2 deletions
+19
-2
cookies.rst
doc/sphinx/tutorial/cookies.rst
+19
-2
No files found.
doc/sphinx/tutorial/cookies.rst
View file @
56cfc908
...
...
@@ -64,8 +64,25 @@ cookies named COOKIE1 and COOKIE2 and you can marvel at it::
}
}
The example is taken from the Varnish Wiki, where you can find other
scary examples of what can be done in VCL.
A somewhat simpler example that can accomplish almost the same can be
found below. Instead of filtering out the other cookies it picks out
the one cookie that is needed, copies it to another header and then
copies it back, deleting the original cookie header.::
sub vcl_recv {
# save the original cookie header so we can mangle it
set req.http.X-Varnish-PHP_SID = req.http.Cookie;
# using a capturing sub pattern, extract the continuous string of
# alphanumerics that immediately follows "PHPSESSID="
set req.http.X-Varnish-PHP_SID =
regsuball(req.http.X-Varnish-PHP_SID, ";? ?PHPSESSID=([a-zA-Z0-9]+)( |;| ;).*","\1");
set req.http.Cookie = req.X-Varnish-PHP_SID;
remove req.X-Varnish-PHP_SID;
}
There are other scary examples of what can be done in VCL in the
Varnish Cache Wiki.
Cookies coming from the backend
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
...
...
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