I have ip_geoloc enabled with session_cache, set to use cookie storage for user location, in an attempt to make this work with Varnish. The one thing I am confused about is that the session cache cookie gets set on every page, even though I've configured ip_geoloc to sample the visitor's location from only a single page that contains a map. This is also true when using $_SESSION storage by disabling session_cache, so I believe it is set from ip_geoloc. Is this the intended behavior?

In this case, caching is disabled at Varnish on every page because ip_geoloc is setting the cookie. Is it is necessary to always deliver an uncached page with the session_cache cookie in order for this module to work? So if you want this to work on your home page, it would never be cacheable. Is my understanding correct?

Any configuration suggestions you can provide would be helpful. Thanks!

Comments

rdeboer’s picture

The cookie will continue to live in the visitor's browser until it expires. That's not ip_geoloc doing that, that's how cookies work.

The trick is to control how Varnish responds to cookies via the Varnish configuration file.
See: https://drupal.org/comment/8353871#comment-8353871

Rik

vinmassaro’s picture

Thanks for the feedback. I thought that I would not see a Set-Cookie header get set on pages other than the ones specified in 'Data collection' options, so I must have misunderstood this setting. I see now that I am only prompted for location on the specified pages.

Since we maintain a single Varnish configuration for a multi-tenant university Drupal environment, I don't really want to introduce site-specific page rules. Since the client sends the cookie every time, it sounds like we need to remove the cookie on pages that do not contain a map. Does that sound right? I can't think of any way to do this in the VCL without checking a header coming from Drupal.

rdeboer’s picture

That sounds right.

rdeboer’s picture

Status: Active » Closed (works as designed)

Closing due to inactivity.