Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
varnish-devicedetect
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-devicedetect
Commits
2881bda3
Commit
2881bda3
authored
Apr 22, 2020
by
Jonathan Huot
Committed by
Dridi Boukelmoune
Aug 05, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix indentation
parent
7387ecb5
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
20 deletions
+20
-20
samesite.vcl
samesite.vcl
+2
-2
10-samesite.vtc
tests/10-samesite.vtc
+18
-18
No files found.
samesite.vcl
View file @
2881bda3
sub samesite {
# See list here:
# https://www.chromium.org/updates/same-site/incompatible-clients
unset req.http.X-UA-SameSiteNone;
set req.http.X-UA-SameSiteNone = "supported";
unset req.http.X-UA-SameSiteNone;
set req.http.X-UA-SameSiteNone = "supported";
# Versions of Chrome from Chrome 51 to Chrome 66 (inclusive on both ends). These Chrome versions will reject a cookie with `SameSite=None`
if (req.http.user-agent ~ "Chrom(e|ium)" &&
...
...
tests/10-samesite.vtc
View file @
2881bda3
...
...
@@ -17,7 +17,7 @@ server s1 -repeat 2 {
varnish v1 -vcl+backend {
include "${projectdir}/samesite.vcl";
sub vcl_deliver {
call samesite;
call samesite;
if (resp.http.set-cookie &&
resp.http.set-cookie ~ "ThirdPartyCookie=" &&
...
...
@@ -26,44 +26,44 @@ varnish v1 -vcl+backend {
if (req.http.X-UA-SameSiteNone == "supported") {
set resp.http.Set-Cookie = resp.http.set-cookie + ";SameSite=None";
}
}
}
}
} -start
# test with browser which does not support SameSite=None
client c1 {
txreq -hdr "User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3904.130"
rxresp
expect resp.http.Set-Cookie == "FirstPartyCookie=foobar"
rxresp
expect resp.http.Set-Cookie == "FirstPartyCookie=foobar"
txreq -hdr "User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3904.130"
rxresp
expect resp.http.Set-Cookie == "ThirdPartyCookie=foobar"
rxresp
expect resp.http.Set-Cookie == "ThirdPartyCookie=foobar"
txreq -hdr "User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3904.130"
rxresp
expect resp.http.Set-Cookie == "ThirdPartyCookie=foobar;Path=/;Secure"
rxresp
expect resp.http.Set-Cookie == "ThirdPartyCookie=foobar;Path=/;Secure"
txreq -hdr "User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3904.130"
rxresp
expect resp.http.Set-Cookie == "ThirdPartyCookie=foobar;SameSite=lax"
rxresp
expect resp.http.Set-Cookie == "ThirdPartyCookie=foobar;SameSite=lax"
} -run
# test with browser which support SameSite=None
client c1 {
txreq -hdr "User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.3904.130"
rxresp
expect resp.http.Set-Cookie == "FirstPartyCookie=foobar"
rxresp
expect resp.http.Set-Cookie == "FirstPartyCookie=foobar"
txreq -hdr "User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.3904.130"
rxresp
expect resp.http.Set-Cookie == "ThirdPartyCookie=foobar;SameSite=None"
rxresp
expect resp.http.Set-Cookie == "ThirdPartyCookie=foobar;SameSite=None"
txreq -hdr "User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.3904.130"
rxresp
expect resp.http.Set-Cookie == "ThirdPartyCookie=foobar;Path=/;Secure;SameSite=None"
rxresp
expect resp.http.Set-Cookie == "ThirdPartyCookie=foobar;Path=/;Secure;SameSite=None"
txreq -hdr "User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.3904.130"
rxresp
expect resp.http.Set-Cookie == "ThirdPartyCookie=foobar;SameSite=lax"
rxresp
expect resp.http.Set-Cookie == "ThirdPartyCookie=foobar;SameSite=lax"
} -run
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