Setting user_ip from a cookie #34

chmac opened this Issue Feb 13, 2012 · 1 comment


None yet

2 participants

chmac commented Feb 13, 2012

I'm trying to build a totally static site so as to be able to serve all pages from cache. In order to do that, I'm thinking about getting boomerang's user_ip value from a cookie. I'd ideally set it in a header, but I can't find any way to read the header within Javascript. By doing so, I can have the varnish server set the user's ip in a Set-Cookie header, and keep the whole site in varnish.

So far I've got varnish setting the header. I've got a solid handle on how to get the value from document.cookie, although I'm still wrapping my head around ipv6 compatibility.

Any feedback before I charge ahead? Am I barking up the wrong tree?

Cheers - Callum.


Hi Callum,

You can read cookies in JavaScript using document.cookie, or just reuse boomerang's BOOMR.utils.getCookie and BOOMR.utils.getSubCookies methods.

Keep in mind though, that varnish may not cache responses that have a Set-Cookie header. I don't know if this changes if varnish itself sets the header.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment