From d119d8381d6d5549573d0e7bb02c2d2c17f70573 Mon Sep 17 00:00:00 2001 From: Lars Boldt Date: Wed, 13 Mar 2019 12:20:22 +0100 Subject: [PATCH] adds support for varnish_ban_key --- README.md | 2 ++ src/drivers/Varnish.php | 1 + 2 files changed, 3 insertions(+) diff --git a/README.md b/README.md index a9b6f50..9ba8fef 100644 --- a/README.md +++ b/README.md @@ -77,7 +77,9 @@ Varnish URL supports multiple servers, separate with comma. E.g `http://1.1.1.1, ``` UPPER_DRIVER=varnish VARNISH_URL= +VARNISH_BAN_KEY= ``` +`VARNISH_BAN_KEY` lets you specify a unique id which you can pick up in your VCL and issue the correct bans. Very useful when you have multiple sites hosted on the same backends and you want to control what to ban. ### Tuning diff --git a/src/drivers/Varnish.php b/src/drivers/Varnish.php index b9da0ec..30c076a 100644 --- a/src/drivers/Varnish.php +++ b/src/drivers/Varnish.php @@ -76,6 +76,7 @@ public function purgeUrls(array $urls) */ public function purgeAll() { + $this->headers['Varnish_Ban_Key'] = getenv('VARNISH_BAN_KEY'); return $this->sendPurgeRequest([ 'headers' => $this->headers ], 'BAN');