diff --git a/platform/varnish.vcl.template b/platform/varnish.vcl.template index bc3cf363e..96ca4335f 100644 --- a/platform/varnish.vcl.template +++ b/platform/varnish.vcl.template @@ -58,6 +58,11 @@ sub vcl_recv { set req.http.Cookie = regsuball(req.http.Cookie, ";[^ ][^;]*", ""); set req.http.Cookie = regsuball(req.http.Cookie, "^[; ]+|[; ]+$", ""); + if (req.http.Cookie ~ "LinkedDataHub\.id_token=") { + # Extract the LinkedDataHub.id_token value + set req.http.X-LinkedDataHub-Id-Token = regsub(req.http.Cookie, ".*LinkedDataHub\.id_token=([^; ]+).*", "\1"); + } + if (req.http.cookie ~ "^\s*$") { unset req.http.cookie; } @@ -70,10 +75,16 @@ sub vcl_hash { hash_data(req.url); hash_data(req.http.Host); + # include the client certificate in the hash, if it exists if (req.http.Client-Cert) { hash_data(req.http.Client-Cert); } + # include LinkedDataHub.id_token cookie value in the hash, if it exists + if (req.http.X-LinkedDataHub-Id-Token) { + hash_data(req.http.X-LinkedDataHub-Id-Token); + } + return (lookup); }