From 50f68e6197f2500fa9758155578e865fafdd5b7d Mon Sep 17 00:00:00 2001 From: Mauro Amico Date: Wed, 27 Mar 2024 20:21:25 +0100 Subject: [PATCH] vcl_synth --- CHANGES.rst | 3 ++- README.rst | 2 +- plone/recipe/varnish/recipe.py | 1 + plone/recipe/varnish/templates/varnish6.vcl.jinja2 | 1 + 4 files changed, 5 insertions(+), 2 deletions(-) diff --git a/CHANGES.rst b/CHANGES.rst index d672c15..08d6340 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -4,7 +4,8 @@ Changelog 6.0.12 (unreleased) ------------------- -- Nothing changed yet. +- Add vcl_synth options to insert arbitrary vcl. + [mamico] 6.0.11 (2023-08-18) diff --git a/README.rst b/README.rst index 7bad462..9444d3b 100644 --- a/README.rst +++ b/README.rst @@ -308,7 +308,7 @@ These options are available for the recipe part plone.recipe.varnish:configurati Specifies hostnames or IP addresses for purge ACL. By default ``localhost`` and the backends are allowed to purge. Additional allowed hosts are listed here. -``vcl_recv``, ``vcl_hit``, ``vcl_miss``, ``vcl_backend_fetch``, ``vcl_backend_response``, ``vcl_deliver``, ``vcl_pipe``, ``vlc_purge``, ``vcl_hash``, ``vcl_import``, ``vcl_init``, ``vcl_pass`` +``vcl_recv``, ``vcl_hit``, ``vcl_miss``, ``vcl_backend_fetch``, ``vcl_backend_response``, ``vcl_deliver``, ``vcl_pipe``, ``vlc_purge``, ``vcl_hash``, ``vcl_import``, ``vcl_init``, ``vcl_pass``, ``vcl_synth`` Insert arbitrary VCL code into the generated config. ``verbose-headers`` diff --git a/plone/recipe/varnish/recipe.py b/plone/recipe/varnish/recipe.py index 52de39a..8d01455 100644 --- a/plone/recipe/varnish/recipe.py +++ b/plone/recipe/varnish/recipe.py @@ -300,6 +300,7 @@ def create_varnish_configuration(self): "vcl_pipe", "vcl_backend_response", "vcl_hash", + "vcl_synth", ): config["custom"][name] = self.options.get(name, "") diff --git a/plone/recipe/varnish/templates/varnish6.vcl.jinja2 b/plone/recipe/varnish/templates/varnish6.vcl.jinja2 index 80dbabe..cd0d254 100644 --- a/plone/recipe/varnish/templates/varnish6.vcl.jinja2 +++ b/plone/recipe/varnish/templates/varnish6.vcl.jinja2 @@ -356,6 +356,7 @@ sub vcl_deliver { We can come here "invisibly" with the following errors: 413, 417 & 503 */ sub vcl_synth { + {{custom['vcl_synth']}} set resp.http.Content-Type = "text/html; charset=utf-8"; set resp.http.Retry-After = "5";