{"result":{"depiction_url":null,"edges":{"hasreference":{"objects":[{"created":"2026-10-07T11:13:46Z","object_id":{"id":1790,"is_a":["text","documentation","developerguide"],"name":"doc_developerguide_deployment_nginx","title":{"_type":"trans","tr":{"en":"Put Zotonic behind nginx"}},"uri":"https:\/\/zotonic.com\/id\/1790"},"seq":1},{"created":"2026-10-07T11:13:46Z","object_id":{"id":2946,"is_a":["text","documentation","developerguide"],"name":"developer_template_cache","title":{"_type":"trans","tr":{"en":"Cache a template fragment"}},"uri":"https:\/\/zotonic.com\/id\/2946"},"seq":2}],"predicate":{"id":2774,"is_a":["meta","predicate"],"name":"hasreference","title":{"_type":"trans","tr":{"en":"Documentation reference"}},"uri":"https:\/\/zotonic.com\/id\/hasreference"}},"subject":{"objects":[{"created":"2026-10-07T11:13:46Z","object_id":{"id":2554,"is_a":["categorization","keyword","keyword_information_type"],"name":"zotonic_topic_how_to_guide","title":"How-to guide","uri":"https:\/\/zotonic.com\/id\/2554"},"seq":1},{"created":"2026-10-07T11:13:46Z","object_id":{"id":2566,"is_a":["categorization","keyword","keyword_audience"],"name":"zotonic_topic_operator","title":"Operator","uri":"https:\/\/zotonic.com\/id\/2566"},"seq":2},{"created":"2026-10-07T11:13:46Z","object_id":{"id":2630,"is_a":["categorization","keyword","keyword_architecture"],"name":"zotonic_topic_cache","title":"Cache","uri":"https:\/\/zotonic.com\/id\/2630"},"seq":3},{"created":"2026-10-07T11:13:46Z","object_id":{"id":2688,"is_a":["categorization","keyword","keyword_quality"],"name":"zotonic_topic_performance","title":"Performance","uri":"https:\/\/zotonic.com\/id\/2688"},"seq":4},{"created":"2026-10-07T11:13:46Z","object_id":{"id":2676,"is_a":["categorization","keyword","keyword_technology"],"name":"zotonic_topic_http","title":"HTTP","uri":"https:\/\/zotonic.com\/id\/2676"},"seq":5}],"predicate":{"id":308,"is_a":["meta","predicate"],"name":"subject","title":{"_type":"trans","tr":{"en":"Keyword"}},"uri":"http:\/\/purl.org\/dc\/elements\/1.1\/subject"}}},"id":1990,"is_a":["text","documentation","developerguide"],"links":[{"rel":"self","target":"https:\/\/zotonic.com\/.zotonic\/websub\/topic\/1990"},{"rel":"hub","target":"https:\/\/zotonic.com\/.zotonic\/websub"}],"medium":null,"medium_url":null,"name":"doc_developerguide_deployment_varnish","page_url":{"en":"https:\/\/zotonic.com\/docs\/1990\/cache-selected-public-assets-with-varnish","x-default":"https:\/\/zotonic.com\/docs\/1990\/cache-selected-public-assets-with-varnish"},"preview_url":null,"resource":{"body":{"_type":"trans","tr":{"en":"<p>Use a supported Varnish installation and its matching VCL reference. Terminate HTTPS in the public proxy; Varnish&#39;s ordinary HTTP backend configuration does not itself provide that TLS endpoint. Keep the backend and management interface private.<\/p>\n<p>Start with an explicit public asset policy. This VCL 4.1 example passes everything except anonymous requests under <code>\/lib\/<\/code>:<\/p>\n<pre class=\"notranslate\"><code class=\"notranslate language-vcl\">vcl 4.1;\n\nbackend default {\n    .host = &quot;127.0.0.1&quot;;\n    .port = &quot;8000&quot;;\n}\n\nsub vcl_recv {\n    if (req.method != &quot;GET&quot; &amp;&amp; req.method != &quot;HEAD&quot;) {\n        return (pass);\n    }\n    if (req.http.Authorization || req.http.Cookie || req.http.Upgrade) {\n        return (pass);\n    }\n    if (req.url !~ &quot;^\/lib\/&quot;) {\n        return (pass);\n    }\n}\n<\/code><\/pre>\n<p>Let the built-in VCL process the remaining request and backend response. Do not strip <code>Set-Cookie<\/code>, override private\/no-store responses, or force a positive TTL onto them. Keep media, API, admin, login and MQTT\/WebSocket traffic out of this initial cache policy; the outer proxy should route WebSocket upgrades directly to Zotonic.<\/p>\n<p>Validate the configuration with the installed Varnish version before loading it. Test an anonymous asset twice, then authenticated pages and a response with <code>Cache-Control: private<\/code> or <code>no-store<\/code>. Confirm only intended public content becomes a cache hit. Add page or media caching only after reviewing Zotonic&#39;s visibility, cache headers and invalidation requirements.<\/p>\n<p>The old VCL 3 callbacks (<code>vcl_fetch<\/code>, <code>vcl_error<\/code>) and <code>req.request<\/code> field are obsolete. Use the <a href=\"https:\/\/varnish-cache.org\/docs\/\">current Varnish documentation<\/a> for the version you deploy.<\/p>"}},"category_id":{"id":317,"is_a":["meta","category"],"name":"developerguide","title":"Developer guide","uri":"https:\/\/zotonic.com\/id\/developerguide"},"content_group_id":{"id":339,"is_a":["meta","content_group"],"name":"default_content_group","title":{"_type":"trans","tr":{"en":"Default Content Group"}},"uri":"https:\/\/zotonic.com\/id\/default_content_group"},"created":"2020-05-30T05:47:48Z","creator_id":{"id":336,"is_a":["person","robot"],"name":"gitbot","title":"Git","uri":"https:\/\/zotonic.com\/id\/336"},"doc_editorial_bundle":true,"doc_editorial_edges":{"hasreference":[1790,2946],"subject":[2554,2566,2630,2676,2688]},"github_url":"https:\/\/github.com\/zotonic\/zotonic\/tree\/master\/doc\/developer-guide\/deployment\/varnish.rst","is_authoritative":true,"is_dependent":false,"is_featured":false,"is_protected":false,"is_published":true,"is_unfindable":false,"language":["en"],"modified":"2026-10-07T11:13:58Z","modifier_id":{"id":1,"is_a":["person"],"name":"administrator","title":"Site Administrator","uri":"https:\/\/zotonic.com\/id\/1"},"name":"doc_developerguide_deployment_varnish","pivot_geocode":null,"pivot_location_lat":null,"pivot_location_lng":null,"privacy":0,"publication_end":"9999-06-01T00:00:00Z","publication_start":"2022-02-15T10:01:38Z","slug":"cache-selected-public-assets-with-varnish","summary":{"_type":"trans","tr":{"en":"Start with a narrow VCL 4 policy and preserve authenticated responses."}},"title":{"_type":"trans","tr":{"en":"Cache selected public assets with Varnish"}},"title_slug":{"_type":"trans","tr":{"en":"cache-selected-public-assets-with-varnish"}},"tz":"UTC","uri":null,"version":35,"visible_for":0},"uri":"https:\/\/zotonic.com\/id\/1990","uri_template":"https:\/\/zotonic.com\/id\/:id","websub":{"hub":"https:\/\/zotonic.com\/.zotonic\/websub","topic":"https:\/\/zotonic.com\/.zotonic\/websub\/topic\/1990"}},"status":"ok"}