Created
December 18, 2017 21:25
-
-
Save hvelarde/df595cb92e1928bdfaa8b046d104939f to your computer and use it in GitHub Desktop.
Varnish configuration to be used with HAProxy backends
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
vcl 4.0; | |
import directors; | |
# probe definition for health checks | |
probe healthcheck { | |
.interval = 2s; | |
.url = "/haproxy?monitor"; | |
.timeout = 1s; | |
.threshold = 3; | |
.window = 5; | |
} | |
# backend definitions for HAProxy load balancers | |
backend default { | |
.host = "127.0.0.1"; | |
.port = "8080"; | |
.probe = healthcheck; | |
.first_byte_timeout = 2m; | |
} | |
backend backup { | |
.host = "SRV_BACKUP"; | |
.port = "8080"; | |
.probe = healthcheck; | |
.first_byte_timeout = 2m; | |
} | |
sub vcl_init { | |
new haproxy = directors.fallback(); | |
haproxy.add_backend(default); | |
haproxy.add_backend(backup); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment