Setting a region cookie
colas.delmas at gmail.com
Thu Mar 9 12:40:14 CET 2017
Be careful the method in the link given by Michael doesn't work.
To set a cookie, you must use the vmod header.
And in the subroutines *vcl_deliver* you must add sotmehting like this
(just change the name of the cookie and the value)
Because using the set resp.http.Set-Cookie = overwrite all Cookie written
by the backend.
I just implement this method in my website to get Analytics stats of my
http://tutoandco.colas-delmas.fr/ <colas.delmas at gmail.com>
2017-03-08 23:13 GMT+01:00 Michael Loftis <mloftis at wgops.com>:
> You're setting it in the wrong place/way. To set a cookie in the
> browser you must set it in the response sent to the browser inside of
> say vcl_deliver. There's no variables so if you need to propogate
> data from e/g vcl_recv you can set an "internal" header on the
> req....see say https://www.fastly.com/blog/vcl-cookie-monster for an
> On Wed, Mar 8, 2017 at 1:38 PM, Mike Alberghini <MAlberghini at habitat.org>
> > We’re trying to get a varnish setup running that sets a regional cookie.
> > I’m having some troubles getting it to work, so any advice will be
> > appreciated.
> > We’re running Drupal 8 and Varnish 4.1.5 with the geoip2 vmod. IP
> > Geolocation is working fine, and our X-GeoIP headers are being set
> > correctly. What I would like to do is have varnish set a "country”
> > when requests to our home page come in. I’ve got it manipulating the
> > req.http.Cookie header, but it does not seem to be actually setting a
> > in the browser. Any suggestions?
> > --
> > Mike Alberghini
> > Software Developer, Habitat for Humanity International
> > 270 Peachtree Street NW, Suite 1300, Atlanta, GA 30303
> > office phone: (404) 420-6751
> > malberghini at habitat.org · habitat.org | Habitat. We build.
> > _______________________________________________
> > varnish-misc mailing list
> > varnish-misc at varnish-cache.org
> > https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc
> "Genius might be described as a supreme capacity for getting its possessors
> into trouble of all kinds."
> -- Samuel Butler
> varnish-misc mailing list
> varnish-misc at varnish-cache.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the varnish-misc