Created
September 14, 2018 20:30
-
-
Save nbeguier/9b78234c490104da58dfa781ee2b161e to your computer and use it in GitHub Desktop.
VARNISH : Usage of libvmod-dynamic
This file contains hidden or 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
vcl 4.0; | |
# Add import | |
import dynamic; | |
# Probe for backend api server | |
probe api_probe { | |
.interval = 5s; | |
.timeout = 1s; | |
.window = 5; | |
.threshold = 3; | |
.initial = 3; | |
} | |
# Define IPv4 only ACL for the module | |
acl ipv4_only { "0.0.0.0"/0; } | |
# in "vcl_init" | |
new api_1 = dynamic.director( | |
port = "80", | |
probe = api_probe, | |
ttl = 2m, | |
whitelist = ipv4_only | |
); | |
# in "vcl_recv" | |
set req.backend_hint = api_1.backend("api1.domain.com"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment