Changing req.hash

Martin Goldman me at mgoldman.com
Wed Jun 2 15:15:03 CEST 2010


Thanks Tollef, it looks like that worked.

The reason I'm trying to do this is that we don't have a separate URL for
our mobile site -- users on both mobile and regular platforms access the
URL, and then the application renders the mobile view of the site if the
useragent matches an appropriate regex, and the regular view otherwise. By
messing with the hash, we can cache the two versions separately.

Thanks again,
Martin

On Wed, Jun 2, 2010 at 4:01 AM, Tollef Fog Heen <tfheen at varnish-software.com
> wrote:

> ]] Martin Goldman
>
> | But I'm not totally clear on how appending "mobile" to the hash changes
> the
> | syntax. I remember reading once that custom VCL runs *before* the default
> | VCL, so I thought the hash would be something like this:
> |
> |  ^mobile/this/is/the/uri#mysite.com#$
> |
> | However, purging that doesn't work. Any ideas?
>
> It's more likely to be ^mobile#/this/is/the/uri#mysite.com#$, but why
> don't you just purge by host and url instead?
>
> purge("req.url == " req.url " && req.http.host == " req.http.host); at
> the right place in your VCL.
>
> --
> Tollef Fog Heen
> Varnish Software
> t: +47 21 54 41 73
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.varnish-cache.org/lists/pipermail/varnish-misc/attachments/20100602/2a81e269/attachment-0003.html>


More information about the varnish-misc mailing list