Skip to content
This repository has been archived by the owner on Apr 15, 2019. It is now read-only.

Setting user_ip from a cookie #34

Open
chmac opened this issue Feb 13, 2012 · 1 comment
Open

Setting user_ip from a cookie #34

chmac opened this issue Feb 13, 2012 · 1 comment

Comments

@chmac
Copy link
Contributor

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.

@bluesmoon
Copy link
Contributor

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.

bluesmoon pushed a commit to bluesmoon/boomerang that referenced this issue Apr 2, 2015
Page group order tests and .eslint changes
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants