Subdomains and Cookies #1193
-
Hey folks, Running into an issue where Payload running on a subdomain fails to set an auth cookie properly. With Payload is running on User collection:
From inspecting requests, the correct response appears to be sent from payload however no cookie is ever actually set. The issue seems similar to discussion #401 however I wasn't able to identify the issue with the cookie not setting. Any thoughts? |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 1 reply
-
Hey @imphillipzissou — this is strange. At first glance everything looks right. Can you try this in Chrome? I believe Chrome will show a little yellow warning sign if a cookie is not set successfully. And it typically comes with the reason why. Looks like you're using Safari, right? |
Beta Was this translation helpful? Give feedback.
-
@jmikrut Thanks for replying so quickly! Correct, this was with Safari. I just tried this on Chrome too, however same behavior and no little yellow warnings. |
Beta Was this translation helpful? Give feedback.
-
Hmm, the only thing I can see here is that in Chrome, the |
Beta Was this translation helpful? Give feedback.
-
Took a minute but here's what I did to reproduce.
Then I tried a few different approaches.
Additional (kind of) related behaviors:
Not sure what the heck is going on here! lol Edit: Seems like it's specific to REST fetch requests so looking into this and CORS configuration a little more. Edit: Am a goof. lol There are a couple things at play. Ultimately I was calling the payload rest api in |
Beta Was this translation helpful? Give feedback.
Took a minute but here's what I did to reproduce.
Cloned and installed the Payload Next Auth repo: payload-cms-next. Locally, I'm using Traefik, dnsmasq, for the certificate and resolution. Configured this to run and resolve on
payload.cookie.domain.com
.Cloned and installed the Next Auth Frontend repo: next-auth-frontend. Again, locally using Traefik and dnsmasq for valid certs and resolution. Configured this to run and resolve on
cookie.domain.com
. Set theNEXT_PUBLIC_CMS_URL
env. var. to point topayload.cookie.domain.com
.Then I tried a few different approaches.
Users
collection to observe the initial behavior:payload.co…