On Fri, Dec 2, 2016 at 3:51 AM, Andreas Plesner <[email protected]> wrote:
>
> Yes. This is what we do:
>
> sub vcl_deliver {
> if ((resp.status == 301) || (resp.status == 302)) {
> set req.url = regsub(resp.http.Location,"^http://[^/]+(.*)","\1");
> return(restart);
> }
> }
>
> Handling of the host header (and all the possible backends) is left as an
> exercise for the reader.
>
> What this does is that it caches the redirect as well as the destination,
> thus
> sort-of normalizing the request, while still caching the ultimate
> destination
> only once.
>
>
Tentatively your rules work for me. Is there any way for varnish to cache
the 302 redirect if its on a completely different host? In my example we
are hitting media.domain.com which hits an nginx server that redirects it
to a completely different URL (S3) that varnish is not caching. After
testing your rule, I see that its definitely skipping a step and providing
the destination URL (S3) to the browser. But that destination is not being
cached.
Is there a way to hide that hostname/url change completely so its
transparent to the end user?
_______________________________________________
varnish-misc mailing list
[email protected]
https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc