Expand my Community achievements bar.

Enhance your AEM Assets & Boost Your Development: [AEM Gems | June 19, 2024] Improving the Developer Experience with New APIs and Events

SDI Cookie is not being saved

Avatar

Community Advisor

I was trying to add Sling Dynamic Include (SDI) in a component that is set cookie in the browser.
Before SDI Enable:

+ The Dispatcher cache was disabled.

+ Each time the page is refreshed, the component Model class is rendered and set cookie in the browser.

After Enable SDI:
+ Dispatcher cache is enabled and the page is being cached.

+ Also enabled the SDI so the component is not being cached. (I checked the corresponding HTML code from the dispatcher cache it's working. The component is not being cached.) Also, I checked the server log, the Model log is also written in the publish server.

+ But the cookie is not set in the browser.

 

Why this happened? Or what could be the possible solution or mistake?

 

My OSGI Config

{
"include-filter.config.enabled":true,
"include-filter.config.path":"/content",
"include-filter.config.resource-types":[
"my-project/components/content/meta-navigation",
"my-project/components/content/lms-survey"
],
"include-filter.config.include-type":"SSI",
"include-filter.config.add_comment":true,
"include-filter.config.selector":"nocache",
"include-filter.config.required_header":"Server-Agent=Communique-Dispatcher",
"include-filter.config.appendSuffix": true
}
4 Replies

Avatar

Community Advisor

Hi, 

Are you testing with a CDN on top of your dispatcher? Keep in mind that cookies are set via a header, so there may be a chance that the CDN or even the browser is caching the header, and thus the cookie is not being recreated.



Esteban Bustamante

Avatar

Community Advisor

Hello @EstebanBustamante ,

Actually, This happened on with my local dispatcher also.
After debugging local, the code is executed but the cookie is not set.

Avatar

Community Advisor

Ok if you are testing locally what may be happening is that your cookie is marked as "secure" and if you don't haver your local dispatcher running over HTTPS this won't be set. Can you double-check that?



Esteban Bustamante

Avatar

Community Advisor

Yes, I checked both. Also in the higher environment, the issue exists. 
Note: The Dev server doesn't have any CDN.