-
Notifications
You must be signed in to change notification settings - Fork 86
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
vmod-saintmode: Allow using denylist in vcl_backend_error
In a way, this reverts [1]. Previously, we would prevent users from blacklisting a backend from vcl_backend_error. But this is actually useful to users: when a backend fails to respond (and is considered healthy due to e.g. a varnishadm call), we may want to blacklist it for a short while, in order to `return (retry)` and be sure that we do not use this backend for our second try. This changes the behavior to checking if there is an available backend, e.g. if we are in vcl_backend_response or vcl_backend_error. [1]: varnish/libvmod-saintmode@d8658c9
- Loading branch information
Showing
4 changed files
with
35 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
varnishtest "Test saintmode blacklist in vcl_backend_error" | ||
|
||
varnish v1 -vcl+backend { | ||
import saintmode from "${vmod_builddir}/.libs/libvmod_saintmode.so"; | ||
|
||
backend ko { | ||
.host = "192.0.2.1"; | ||
.port = "80"; | ||
} | ||
|
||
sub vcl_init { | ||
new sm = saintmode.saintmode(ko, 1); | ||
} | ||
|
||
sub vcl_backend_fetch { | ||
set bereq.backend = sm.backend(); | ||
} | ||
|
||
sub vcl_backend_error { | ||
saintmode.blacklist(0.5s); | ||
} | ||
} -start | ||
|
||
client c1 { | ||
txreq -url "/foo" | ||
rxresp | ||
expect resp.status == 503 | ||
} -run |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters