Skip to content

Commit

Permalink
Merge pull request mattiasgeniar#43 from LukeHandle/patch-1
Browse files Browse the repository at this point in the history
return "miss" instead of return "fetch" (4.1+)
  • Loading branch information
mattiasgeniar authored Sep 17, 2017
2 parents ad44912 + 635d265 commit 8f10a29
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions default.vcl
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ sub vcl_recv {
req.method != "DELETE") {
/* Non-RFC2616 or CONNECT which is weird. */
/*Why send the packet upstream, while the visitor is using a non-valid HTTP method? */
return(synth(404, "Non-valid HTTP method!"));
return (synth(404, "Non-valid HTTP method!"));
}

# Implementing websocket support (https://www.varnish-cache.org/docs/4.0/users-guide/vcl-example-websockets.html)
Expand Down Expand Up @@ -161,7 +161,7 @@ sub vcl_recv {
# like msnbot that send no-cache with every request.
if (! (req.http.Via || req.http.User-Agent ~ "(?i)bot" || req.http.X-Purge)) {
#set req.hash_always_miss = true; # Doesn't seems to refresh the object in the cache
return(purge); # Couple this with restart in vcl_purge and X-Purge header to avoid loops
return (purge); # Couple this with restart in vcl_purge and X-Purge header to avoid loops
}
}

Expand Down Expand Up @@ -259,7 +259,7 @@ sub vcl_hit {
# if (!std.healthy(req.backend_hint) && (obj.ttl + obj.grace > 0s)) {
# return (deliver);
# } else {
# return (fetch);
# return (miss);
# }

# We have no fresh fish. Lets look at the stale ones.
Expand All @@ -270,7 +270,7 @@ sub vcl_hit {
return (deliver);
} else {
# No candidate for grace. Fetch a fresh object.
return(fetch);
return (miss);
}
} else {
# backend is sick - use full grace
Expand All @@ -279,12 +279,12 @@ sub vcl_hit {
return (deliver);
} else {
# no graced object.
return (fetch);
return (miss);
}
}

# fetch & deliver once we get the result
return (fetch); # Dead code, keep as a safeguard
return (miss); # Dead code, keep as a safeguard
}

sub vcl_miss {
Expand Down Expand Up @@ -384,7 +384,7 @@ sub vcl_purge {
if (req.method != "PURGE") {
# restart request
set req.http.X-Purge = "Yes";
return(restart);
return (restart);
}
}

Expand Down

0 comments on commit 8f10a29

Please sign in to comment.