Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # VCL version 5.0 is not supported so it should be 4.0 even though actually used Varnish version is 5
- vcl 4.0;
- import std;
- # The minimal Varnish version is 5.0
- # For SSL offloading, pass the following header in your proxy server or load balancer: 'X-Forwarded-Proto: https'
- backend default {
- .host = "localhost";
- .port = "8080";
- .first_byte_timeout = 600s;
- .probe = {
- #.url = "/pub/health_check.php";
- .timeout = 2s;
- #.interval = 5s;
- #.window = 10;
- #.threshold = 5;
- }
- }
- acl purge {
- "localhost";
- }
- sub vcl_recv {
- if (req.method == "PURGE") {
- if (client.ip !~ purge) {
- return (synth(405, "Method not allowed"));
- }
- # To use the X-Pool header for purging varnish during automated deployments, make sure the X-Pool header
- # has been added to the response in your backend server config. This is used, for example, by the
- # capistrano-magento2 gem for purging old content from varnish during it's deploy routine.
- if (!req.http.X-Magento-Tags-Pattern && !req.http.X-Pool) {
- return (synth(400, "X-Magento-Tags-Pattern or X-Pool header required"));
- }
- if (req.http.X-Magento-Tags-Pattern) {
- ban("obj.http.X-Magento-Tags ~ " + req.http.X-Magento-Tags-Pattern);
- }
- if (req.http.X-Pool) {
- ban("obj.http.X-Pool ~ " + req.http.X-Pool);
- }
- return (synth(200, "Purged"));
- }
- if (req.method != "GET" &&
- req.method != "HEAD" &&
- req.method != "PUT" &&
- req.method != "POST" &&
- req.method != "TRACE" &&
- req.method != "OPTIONS" &&
- req.method != "DELETE") {
- /* Non-RFC2616 or CONNECT which is weird. */
- return (pipe);
- }
- # We only deal with GET and HEAD by default
- if (req.method != "GET" && req.method != "HEAD") {
- return (pass);
Add Comment
Please, Sign In to add comment