I have a page which sends a "Set-Cookie" header for something like the language depending on the URL. The thing is this page will get a fairly high hit rate but it's not an option right now to strip the "Set-Cookie" header so that Varnish 4 will cache it.
The documentation only shows how to unset beresp.http.set-cookie
or that I can add the cookie to the hash with hash_data(req.http.cookie)
. As far as I see, adding the cookie to the hash only apply to request Cookies not to the cookies set by the backend.
I am pretty sure vmod_header could be part of the solution but how would I use it to cache a cookie that I match with beresp.http.Set-Cookie == "language=en_us; path=/; domain=mydomain.tld"
and cache this response?