diff --git a/CHANGES.rst b/CHANGES.rst index 524effd..271c797 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -6,6 +6,8 @@ Changelog - Use Varnish 6.0.13 LTS [mamico] +- 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 714c7e6..d2217f9 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";