So it seems like your blog post may be dated or the VCL you share in gitlabs may be dated... I'm assuming that the VCL is newer. With that said, I'm using the Drupal VM default VCL that looks like the attached file.
My VM settings are set up as the Drupal-VM Defaults where varnish runs on port 81, and apache runs on port 80.
The way I understand this VCL file is that I must pass either a purge or ban method request with the Purge-Cache-Tags header. Doing so will do either of the actions.
I've set up my settings to be very much like your settings. They look like this:
uuid: 9bb13d49-7ecf-499c-8ee7-c48e282c1018
langcode: en
status: true
dependencies: { }
id: 9f5f9893b5
name: 'Varnish HTTP'
invalidationtype: tag
hostname: 127.0.0.1
port: 81
path: /
request_method: BAN
scheme: http
verify: '1'
headers:
-
field: Purge-Cache-Tags
value: '[invalidation:expression]'
body: null
body_content_type: null
runtime_measurement: true
timeout: !!float 1
connect_timeout: !!float 1
cooldown_time: !!float 0
max_requests: 100
http_errors: true
Additionally I have:
$config['system.performance']['cache']['page']['max_age'] = 31536000; # 1year
With that said. I'm doing the following steps.
- In one window navigate to a specific node (Ex: node/1)
- Verify that I get a 200 code and that X-Varnish-Cache:MISS
- Reload the page and verify that I get a 304 code and that X-Varnish-Cache:HIT
- In another (incognito) window, log in
- Navigate too node/1/edit
- Make some changes and hit save.
- run drush p-queue-work
- In the other (anonymous user) window, refresh the page and verify you get a 200, the new content shows up, and X-Varnish-Cache:MISS.
Any thoughts? I did do a diff of the two configuration files and I notice that you use req.http.Cache-Tags instead of req.http.Purge-Cache-Tags.
| Comment | File | Size | Author |
|---|---|---|---|
| default.vcl_.txt | 5.45 KB | generalredneck |
Comments
Comment #2
generalredneckComment #3
generalredneckokok... stupid me... the "Bold Type" disability I have has hit again.
There is a link at the top of the blog that says "Please read this about updates done since the blog post were written.". https://wunderkraut.se/blogg/varnish-purge-8x14-out
Taking a look at that.
Comment #4
misc commentedImportant also to update the VCL to look for Cahe-Tags, not Purge-Cache-Tags (or X-Varnish-Cache).
Comment #5
generalredneckYeah totally...
BTW... a Big ++ for the really fast response.
Got it going. The missing pieces were in your update blog post and explained by the VCL was edited only 17 days ago. I wonder if there is a way we can do a "check" on varnish to see if the new configuration has been applied... Nothing easy comes to mind right off the bat.
Comment #6
misc commentedI hope to define better test cases, also to do some testing on varnish itself with a sub module.