Skip to main content
September 1, 2024
Solved

Not able to find Cookie data in doPost() at SlingHttpServletRequest request

In my AEM application I'm able to fetch the cookie (while landing the home page application) but in SlingHttpServletRequest I'm not able to get SlingHttpServletRequest.getCookie("MypropertyValue") in my dopost method. Can someone help me in looking into the issue and rectify it.

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
arunpatidar
arunpatidarAccepted solution
Community Advisor
September 2, 2024

2 replies

pulkitvashisth
Community Advisor
Community Advisor
September 1, 2024

Hi @anithara 


Same issue happened with me. 
What I was doing wrong was that my cookie scope was wrong i.e. when I checked my cookie was under wrong domain/path. 
When I corrected the cookie domain/path, it worked fine.


Same check you can do, you can compare props for other cookies that are working fine to your 
"MypropertyValue" cookie under dev tools ->  application ->  Storage -> cookies

 

Also make sure that you are not using incorrect cookie name to fetch cookie at backend.
You can try to print all cookies to debug this. ( request.getCookies() )

Translate
arunpatidar
Community Advisor
arunpatidarCommunity AdvisorAccepted solution
Community Advisor
September 2, 2024