From 083357092318e9b08ba400a5270457d563655f10 Mon Sep 17 00:00:00 2001 From: Ambroise Maupate Date: Tue, 28 May 2024 12:10:15 +0200 Subject: [PATCH] feat: Allow exposing `Cache-Tags` header when Varnish serve API and Nuxt responses --- config/packages/nelmio_cors.yaml | 4 ++-- docker/varnish/default.vcl | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/config/packages/nelmio_cors.yaml b/config/packages/nelmio_cors.yaml index a984905..8f22b00 100644 --- a/config/packages/nelmio_cors.yaml +++ b/config/packages/nelmio_cors.yaml @@ -3,8 +3,8 @@ nelmio_cors: origin_regex: true allow_origin: ['%env(CORS_ALLOW_ORIGIN)%'] allow_methods: ['GET', 'OPTIONS', 'POST', 'PUT'] - allow_headers: ['Content-Type', 'Authorization', 'Www-Authenticate', 'x-g-recaptcha-response'] - expose_headers: ['Link', 'Www-Authenticate'] + allow_headers: ['Content-Type', 'Authorization', 'Www-Authenticate', 'x-g-recaptcha-response', 'Cache-Tags'] + expose_headers: ['Link', 'Www-Authenticate', 'Cache-Tags'] max_age: 3600 paths: '^/': ~ diff --git a/docker/varnish/default.vcl b/docker/varnish/default.vcl index f8485ec..e79245c 100644 --- a/docker/varnish/default.vcl +++ b/docker/varnish/default.vcl @@ -195,9 +195,9 @@ sub vcl_deliver { # # You can do accounting or modifying the final object here. - # Remove cache-tags, unless you want Cloudflare or other to see them + # Remove cache-tags, unless you want Cloudflare or Nuxt to see them (to use cache tags on Nuxt responses) + # Make sure to allow CORS on Cache-Tags header if you want to use it on Nuxt. unset resp.http.X-Cache-Tags; - # Comment the following line to send the "Cache-Tags" header to the client (e.g. to use CloudFlare cache tags) unset resp.http.Cache-Tags; }