Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Setting user_ip from a cookie #34

Open
chmac opened this Issue · 1 comment

2 participants

@chmac

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.

@bluesmoon

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
Something went wrong with that request. Please try again.