How to set a cookie for iframe on the same domain
Asked Answered
S

1

7

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

Scoter answered 12/2, 2013 at 16:14 Comment(8)
Do you look at #2117748 ?Saprophyte
this is why I have specified my iframe is on the same domain. I think it is a different use case.Scoter
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.Prefigure
@AskoSoukka it seems to be the good answer. I have added the path option and now it is added in the iframe request.Scoter
Note that there is nothing Plone-specific about your question. :-)Teahouse
@MartijnPieters always here ! The way to set the cookie is specific to plone, because I put a link to a PLone addon I have added the plone tag. I should not use the tag Plone ?Scoter
@toutpt: No need to remove it now; it was theoretically possible that you didn't know how to set the path in your cookie in Plone. :-) (in which case it could be a dupe, there is a question on Plone and cookie setting here on SO already :-)).Teahouse
I think @AskoSoukka should create the answer to close the question, right?Aemia
A
3

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.

Adamantine answered 12/2, 2013 at 16:15 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.