0

I have a site with heavy load that receives an affiliate param like site.com/?account=account and pass it as cookies. Then I load that value from the cookies with javascript and show it as a hidden value of the form page that is cached. This seems to be working fine so far.

The problem is that now I'm using cache with public headers for pages including the join form. When retrieving the cookie value with $.cookie("account") from the javascript file I get a nil value. However If I try calling the cookie from the page itself (even with is public cache headers) it works.

Any idea why this happens and if possible to retrieve the cookie via javascript when page has public headers?

Martin
  • 11,216
  • 23
  • 83
  • 140
  • whether the domain of the cookie and script the same – Arun P Johny Jul 25 '13 at 03:02
  • They are. I haven't changed anything on the design besides adding public headers to the page. – Martin Jul 25 '13 at 03:03
  • are you able to view the cookie using browser tools – Arun P Johny Jul 25 '13 at 03:04
  • yes, I can do `$.cookie("account");` on console and get `"myvalue"` – Martin Jul 25 '13 at 03:08
  • Actually no. If I go to `site.com/?account=a` it is retrieving the previous value set or matching a default. Looks like it is not retrieving the cookie via javascript while the page has public cache even if the cookie is being updated. – Martin Jul 25 '13 at 03:10
  • This behaviour seems to happen when the page is served fresh from cache like `cache: [GET /join?account=myvalue] fresh`, somehow it is bypassing the request and ignoring all parameters. Is there any solution to this? – Martin Jul 25 '13 at 03:16
  • if the page is served from a cache, it will not process the parameters – Arun P Johny Jul 25 '13 at 03:17

0 Answers0