Hi,
I have this logic to read the cookies
Optional<Cookie[]> cookies = Optional.ofNullable(request.getCookies());
if (cookies.isPresent()) {
return Arrays.stream(cookies.get()).filter(cookie -> cookie.getName().equals(cookieName))
.map(cookie -> cookie.getValue()).findFirst();
}
return Optional.empty();
Now the problem is If i hit my page URL from akamai or AEM Publish URL without query param then i am not able read cookie value but if i hit same URL with query param then i am getting correct response. Let my cookie name is ABC and its present in both the cases : with query param and without query param. Also this issue is only happening in one environment and not in other. Is there any configuration which blocks request object to get the cookies?? Because i faced a similar issue where i am not able to read the i18n values until and unless i dont pass query param in URL. Here the main issue is about reading the cookies which i am not able to read if i dont pass some query param even though the cookie is present
Solved! Go to Solution.
Views
Replies
Total Likes
Hi @JavedKh ,
I think your issue is caused by Akamai caching behavior and how it forwards requests to AEM Publish. When you hit the URL without a query parameter, Akamai may serve a cached response and not forward the original request (including cookies) to AEM. When you add a query parameter, Akamai treats it as a unique request, bypasses the cache, and forwards the full request including cookies to AEM.
This behavior is environment-specific because Akamai configurations (like cache key rules and cookie forwarding) can differ between environments.
Try these -
Hi @JavedKh ,
Can you try to follow below steps and see if it helps:-
Inspect HTTP Headers:
Environment Configuration:
Security Settings:
Like if cookie is marked as Secure Flag it will only be transmitted over HTTPS connections. If your AEM instance or the request is not using HTTPS, the browser will not send the cookie, and it will not be available in the request object.
-Tarun
Hi @JavedKh ,
I think your issue is caused by Akamai caching behavior and how it forwards requests to AEM Publish. When you hit the URL without a query parameter, Akamai may serve a cached response and not forward the original request (including cookies) to AEM. When you add a query parameter, Akamai treats it as a unique request, bypasses the cache, and forwards the full request including cookies to AEM.
This behavior is environment-specific because Akamai configurations (like cache key rules and cookie forwarding) can differ between environments.
Try these -
Hi @JavedKh,
Check if Cookie header is being sent in both cases (with/without query param). - Use browser DevTools > Network tab > Request Headers
Use Akamai Debug Headers (eg. Pragma: akamai-x-cache-on) to inspect if response is cached or coming from origin.
Dispatcher could be configured to ignore or block Cookie headers based on:
Cache rules (/cache block)
/headers block (which headers are passed to AEM)
/clientheaders not including Cookie
Check dispatcher.any:
/clientheaders {
...
"Cookie"
...
}
If Cookie is not listed here, it will not be forwarded to AEM.
You can troubleshoot and Compare curl or Postman requests: With and without query param
curl -I -H "Cookie: ABC=value" "https://your-domain.com/page"
curl -I -H "Cookie: ABC=value" "https://your-domain.com/page?test=true"
Views
Likes
Replies