Skip to content

Commit

Permalink
Remove debug synth() and added forced cache invalidation by cookie
Browse files Browse the repository at this point in the history
  • Loading branch information
ibexa-yuna committed Jun 15, 2022
1 parent 8e1d515 commit f620144
Showing 1 changed file with 7 additions and 12 deletions.
19 changes: 7 additions & 12 deletions docs/varnish/vcl/varnish7.vcl
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,11 @@ sub vcl_recv {
if (req.http.cookie == "") {
// If there are no more cookies, remove the header to get page cached.
unset req.http.cookie;
} else {
if (req.http.cookie) {
// Request it by a user with session, miss the cache to avoid issues for editors and forum users
set req.hash_always_miss = true;
}
}
}

Expand All @@ -75,16 +80,6 @@ sub vcl_recv {
return (hash);
}

sub vcl_hit {

if (req.http.cookie) {
// Request it by a user with session, refresh the cache to avoid issues for editors and forum users
return (pass);
}

return (deliver);
}

// Called when the requested object has been retrieved from the backend
sub vcl_backend_response {

Expand Down Expand Up @@ -163,10 +158,10 @@ sub ez_purge {
sub ez_purge_acl {
if (req.http.x-invalidate-token) {
if (req.http.x-invalidate-token != req.http.x-backend-invalidate-token) {
return (synth(405, "Method not allowed (invalid token)"));
return (synth(405, "Method not allowed"));
}
} else if (!client.ip ~ invalidators) {
return (synth(405, "Method not allowed for IP " + client.ip));
return (synth(405, "Method not allowed"));
}
}

Expand Down

0 comments on commit f620144

Please sign in to comment.