Skip to content

Commit

Permalink
Default Varnish VCL template only allows cookies in the admin app (fo…
Browse files Browse the repository at this point in the history
…r login etc.)
  • Loading branch information
namedgraph committed Nov 21, 2024
1 parent f115a97 commit cb4ece0
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions platform/varnish.vcl.template
Original file line number Diff line number Diff line change
Expand Up @@ -57,15 +57,9 @@ sub vcl_recv {
return (pass);
}
if (req.http.Cookie) {
# explicitly allow only cookies required by LDH server-side
set req.http.Cookie = ";" + req.http.Cookie;
set req.http.Cookie = regsuball(req.http.Cookie, "; +", ";");
set req.http.Cookie = regsuball(req.http.Cookie, ";(LinkedDataHub\.state|LinkedDataHub\.id_token)=", "; \1=");
set req.http.Cookie = regsuball(req.http.Cookie, ";[^ ][^;]*", "");
set req.http.Cookie = regsuball(req.http.Cookie, "^[; ]+|[; ]+$", "");

if (req.http.cookie ~ "^\s*$") {
unset req.http.cookie;
# only allow cookies in the admin app (for login etc.)
if(req.url !~ "^/admin(/.*)?$") {
unset req.http.Cookie;
}
}

Expand Down

0 comments on commit cb4ece0

Please sign in to comment.