Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set a cookie for iframe on the same domain

I'm trying to make integration of etherpad-lite in the CMS Plone, following Example 1 of the official documentation http://etherpad.org/doc/v1.2.7/

Portal places the cookie "sessionID" with the given value on the client and creates an iframe including the pad.

Everythings goes well except for the cookie. Reading documentation the best pratice seems to make etherpad-lite in the same domain under a specific path. This is what I have done using /pad/ path.

Plone side if no session has been created, I created on, I add a cookie and then I'm doing a redirect to the same page to be sure the cookie is in the browser.

As a results my cookie is added to the request of the main page but not ob the iframe request.

Here is the google chrome console network tab for the main page and the iframe:

http://toutpt.makina-corpus.org/en/images/cookie-in-iframe/

The code corresponding to the setCookie is at https://github.com/toutpt/collective.etherpad/blob/master/collective/etherpad/archetypes.py#L100

like image 469
toutpt Avatar asked Feb 12 '13 16:02

toutpt


1 Answers

For posterity, here's the answer from @AskoSoukka identified and "accepted" in the comments above:

How does the actual cookie stored in you browser look like? Probably, you need to explicitly specify path="/" in setCookie kwargs to make it work for the whole domain.

like image 144
3 revs, 2 users 67% Avatar answered Nov 25 '22 13:11

3 revs, 2 users 67%