Setting a region cookie

Michael Loftis mloftis at wgops.com
Wed Mar 8 23:13:22 CET 2017


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
example.

On Wed, Mar 8, 2017 at 1:38 PM, Mike Alberghini <MAlberghini at habitat.org> wrote:
> 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” cookie
> 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 cookie
> 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



More information about the varnish-misc mailing list