We developed an app on the node builder. It’s an API system that adds a Set-Cookie header, setting a cookie in the user’s browser as they browse the store.
Since the node app is available on the store’s domain, it’s possible to save first-party cookies this way.
The problem is that the cookie only reaches the controller in dev mode — when we deploy to prod, almost all cookies stop coming through.
I’m retrieving the cookie like this:
ctx.request.headers.cookie:
in dev: complete
in prod: reduced (doesn’t send the cookie we created)
So, since we validate whether the created cookie comes back in the browser’s request, and it doesn’t come back in prod, we’re stuck in a loop creating a new cookie on every request… because the cookie we set never comes back.
It looks like VTEX’s Akamai does a cleanup on cookies and has a whitelist of cookies that actually come through in the “cookie” header.
If it’s working in the development environment, I suggest running a test in the production environment without the WAF, as I believe it may be affecting how the cookies are being read.
As a reminder, in ticket #919919 we already discussed this topic with you. We also mentioned that one of the possible errors when using a reverse proxy is related to the correct forwarding of Akamai headers or cookies to VTEX.