No it does not - it has to match the hash. BAN will do the trick but it has the (small) overhead - depending upon your setup.
My guess is that you might be doing what I was and trying to do in the beginning which was to purge from another interface. Your sub vcl_hash is not returning so the default sub vcl_hash runs after yours and that also hashes the Host header. You could try to add the url to your sub vcl_hash and the last line put "return(hash);" (to prevent the default handler from running.) Then try the same purge test you were doing with the headers set. On Thu, Mar 6, 2014 at 6:50 PM, Paul McInerney < [email protected]> wrote: > I thought that myself, and have tried purging with the specific header > being called - still no luck. > > > > Doesn't a purge by default, remove all variants of the specified URL? > > > > J > > > > *From:* Jennings, Raymond [mailto:[email protected]] > *Sent:* Friday, 7 March 2014 10:06 AM > *To:* Paul McInerney > *Cc:* [email protected] > *Subject:* Re: varnish 3.0 + mobile app > > > > 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 < > [email protected]> 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: [email protected] > > > > > _______________________________________________ > varnish-misc mailing list > [email protected] > https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc > > >
_______________________________________________ varnish-misc mailing list [email protected] https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc
