Cookie is not getting created through dispatcher

Avatar

Avatar
Contributor 2
Level 4
Dinu_Arya
Level 4

Likes

38 likes

Total Posts

184 posts

Correct reply

16 solutions
Top badges earned
Contributor 2
Applaud 25
Validate 50
Validate 25
Validate 10
View profile

Avatar
Contributor 2
Level 4
Dinu_Arya
Level 4

Likes

38 likes

Total Posts

184 posts

Correct reply

16 solutions
Top badges earned
Contributor 2
Applaud 25
Validate 50
Validate 25
Validate 10
View profile
Dinu_Arya
Level 4

08-01-2018

Hi Team,

I have to create a cookie based the page which is opened. It is getting created in publish instance. But when I accessed the same page through dispatcher, the cookie is not getting created. I have seen this thread - CQ dispatcher - Cookie issue . As per this we shouldn't cache pages, but my pages should cached.

Is there any way to create cookie through dispatcher by allowing the respective cookie names using any of the dispatcher configuration rules?

I'm using AEM 6.2.

Please help me in this. If there is no configuration from dispatcher end, I will follow the second solution given by Jorg.CQ dispatcher - Cookie issue​@

Thanks,

AryA.

Replies

Avatar

Avatar
Validate 25
Level 10
smacdonald2008
Level 10

Likes

1,409 likes

Total Posts

12,671 posts

Correct reply

2,278 solutions
Top badges earned
Validate 25
Validate 10
Validate 1
Give back 900
Give back 600
View profile

Avatar
Validate 25
Level 10
smacdonald2008
Level 10

Likes

1,409 likes

Total Posts

12,671 posts

Correct reply

2,278 solutions
Top badges earned
Validate 25
Validate 10
Validate 1
Give back 900
Give back 600
View profile
smacdonald2008
Level 10

08-01-2018

See this thread where Joerg talked about this subject -- CQ dispatcher - Cookie issue

Avatar

Avatar
Validate 1
Level 10
edubey
Level 10

Likes

277 likes

Total Posts

1,502 posts

Correct reply

392 solutions
Top badges earned
Validate 1
Give Back 50
Give Back 5
Give Back 3
Give Back 25
View profile

Avatar
Validate 1
Level 10
edubey
Level 10

Likes

277 likes

Total Posts

1,502 posts

Correct reply

392 solutions
Top badges earned
Validate 1
Give Back 50
Give Back 5
Give Back 3
Give Back 25
View profile
edubey
Level 10

08-01-2018

What Jörg mentioned is correct. Page gets cached but since cookie is getting created dynamically. You have to follow either of the shared two solution by him to make it work.

Avatar

Avatar
Validate 1
Level 1
jamesm77050123
Level 1

Like

1 like

Total Posts

26 posts

Correct reply

1 solution
Top badges earned
Validate 1
Boost 1
Affirm 1
View profile

Avatar
Validate 1
Level 1
jamesm77050123
Level 1

Like

1 like

Total Posts

26 posts

Correct reply

1 solution
Top badges earned
Validate 1
Boost 1
Affirm 1
View profile
jamesm77050123
Level 1

03-10-2018

I have the exact same problem for cookie functionality I'm working on. I can't delete the cache so I can only use the second solution

  • You create the cookie in a more lightweight call (e.g on an AJAX call), which then creates the cookie.


Is this on a front end level using javascript?

Avatar

Avatar
Contributor 2
Level 4
Dinu_Arya
Level 4

Likes

38 likes

Total Posts

184 posts

Correct reply

16 solutions
Top badges earned
Contributor 2
Applaud 25
Validate 50
Validate 25
Validate 10
View profile

Avatar
Contributor 2
Level 4
Dinu_Arya
Level 4

Likes

38 likes

Total Posts

184 posts

Correct reply

16 solutions
Top badges earned
Contributor 2
Applaud 25
Validate 50
Validate 25
Validate 10
View profile
Dinu_Arya
Level 4

11-10-2018

You can create cookie either from front end using document.cookie or in the back-end using servlet