varnish 3.0 + mobile app

Jennings, Raymond raymond.jennings at nytimes.com
Fri Mar 7 00:06:21 CET 2014


I assume your purge is not hashing properly.  When you purge it has to
match whatever it hashed on when the obj went into the cache.

I have problems using the standard sub vcl_hash so I hash only on the URL
and not the hostname so this let's me purge from outside of the "restricted
area."


In your case I think you probably need to purge all possibilities based on
that X-header you are setting.

If that gets too difficult I fallback on doing a BAN instead.


Ray


On Thu, Mar 6, 2014 at 5:57 PM, Paul McInerney <
Paul.McInerney at faredge.com.au> wrote:

> Hi all,
>
>
>
> We are currently developing a mobile android/iphone app for our website.
>
> When the app hits the varnish frontend, it has the user-agent string set
> as 'mobileapp'.
>
> So I have put in place a subroutine that correctly identifies the app and
> sets a
> custom x-device header to send to the backend for rendering the page(s)
> in the
>
> required format.
>
> This part is working well with the same URL now serving both formats of
> the page,
>
> however when I issue a purge against the URL, it purges the cached
> versions of the
>
> PC version of the page, and doesn't clear all variants (which should
> include the mobileapp
>
> version afaik )
>
> Here's the subroutine called from vlc_recv
>
> sub identify_device {
>         unset req.http.X-UA-Device;
>         set req.http.X-UA-Device = "pc";
>
>  if (req.http.User-Agent ~ "mobileapp" ) {
>         set req.http.X-UA-Device = "mobileapp";
>   }
> }
>
> and the hash being set based on device
>
> sub vcl_hash {
>     if (req.http.X-UA-Device) {
>         hash_data(req.http.X-UA-Device);
>     }
> }
>
> What am I doing wrong? or missing? or not understanding?
>
>
>
> Cheers,
>
>
>
> J
>
>
>
> --
>
> *Paul McInerney*
>
> Senior Systems Administrator
>
> Far Edge Technology
>
>
>
> P:   +61 2  8425 1410
>
> F:   +61 2  8425 1489
>
> M: +61 411 288 030
>
> E:   paul.mcinerney at faredge.com.au
>
>
>
> _______________________________________________
> varnish-misc mailing list
> varnish-misc at varnish-cache.org
> https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.varnish-cache.org/lists/pipermail/varnish-misc/attachments/20140306/5edda2e1/attachment-0001.html>


More information about the varnish-misc mailing list