netlogix / nxvarnish
Adds varnish integration to TYPO3
Installs: 12 496
Dependents: 0
Suggesters: 0
Security: 0
Stars: 2
Watchers: 4
Forks: 0
Open Issues: 1
Type:typo3-cms-extension
Requires
- php: ^8.1
- typo3/cms-core: ^12.4
- typo3/cms-extbase: ^12.4
- typo3/cms-fluid: ^12.4
- typo3/cms-frontend: ^12.4
Requires (Dev)
- ext-sqlite3: *
- phpunit/phpcov: ^9.0
- typo3/testing-framework: ^8.0
README
Adds varnish integration to TYPO3. Ensures varnish caches are flushed when TYPO3 caches are flushed. Uses cache tags to flush all necessary content.
Compatibility
The current version (5.x) of this extension has been tested using these versions:
- TYPO3 12.4 on PHP 8.1
- TYPO3 12.4 on PHP 8.2
Installation
Install the package via composer.
composer require netlogix/nxvarnish
Configuration
TYPO3
This extension provides some configuration in Install Tool.
- varnishHost: required, needed to communicate with Varnish in order to purge caches
- allowCacheLogin: optional, send normal cache headers even when someone is logged in
Varnish
Varnish needs some special configuration to understand cache tags and BAN requests. Add this to your Varnish .vcl:
# WARNING: this is an example how to add tag-based purging to an existing # Varnish configuration. This is *not* a complete configuration! # a list of clients that are allowed to initiate a BAN acl purge { "localhost"; # add whatever IPs are allowed to initiate a BAN "172.16.0.0"/16; # just an example } sub vcl_recv { # ... if (req.method == "BAN") { # only allow cache BANs from known IPs if (!std.ip(req.http.X-Client-Ip, client.ip) ~ purge) { return (synth(405, "Not allowed.")); } # ban using cache tags if (req.http.X-Cache-Tags) { # this will ban all cache objects with matching tags ban("obj.http.X-Cache-Tags ~ " + req.http.X-Cache-Tags); # create an HTTP 200 response and exit return (synth(200, "Ban added.")); } # return an error if no cache tags were provided. # you might need to remove this if you have additional BAN conditions return (synth(400, "Bad Request.")); } # ... } sub vcl_deliver { # ... # remove cache-tags header from response sent to client unset resp.http.X-Cache-Tags; # ... }