https://supertokens.com/ logo
Title
c

Chunkygoo

10/18/2022, 7:24 AM
preceding "."
I noticed that there is a preceding "." when I set cookie_domain to "api-lambda.x.com"
Instead of "api-lambda.x.com", the cookie set is ".api-lambda.x.com"
Is that intended?
r

rp

10/18/2022, 7:35 AM
ye
yes
c

Chunkygoo

10/18/2022, 7:41 AM
What's the reason behind that?
r

rp

10/18/2022, 7:41 AM
sharing session across api domains
c

Chunkygoo

10/18/2022, 7:50 AM
Can I disable it?
I only want api-lambda.x.com to receive it
r

rp

10/18/2022, 7:51 AM
yea. just don't set that value
c

Chunkygoo

10/18/2022, 7:51 AM
If I don't set it, it would be api-lambda.x.com?
r

rp

10/18/2022, 7:51 AM
yes. Automatically
c

Chunkygoo

10/18/2022, 7:51 AM
Awesome, thanks!
Do you know why it doesnt work if I dont set it for localhost tho?
Under the applications tab, I can see the cookies
Just wont send to the backend
r

rp

10/18/2022, 7:54 AM
not sure what your setup is
c

Chunkygoo

10/18/2022, 7:54 AM
I have two backends, one for auth and the rest for data
r

rp

10/18/2022, 7:54 AM
right yea.. different ports
c

Chunkygoo

10/18/2022, 7:54 AM
auth runs on localhost:8001, and the other localhost:8000
r

rp

10/18/2022, 7:54 AM
so you need to set cookie_domain to localhost (i think)
c

Chunkygoo

10/18/2022, 7:54 AM
ok
so in prod
api.x.com
r

rp

10/18/2022, 7:55 AM
in prod, the value of cookie_domain would be
.x.com
if you have api.x.com and auth.x.com (for example)
c

Chunkygoo

10/18/2022, 7:55 AM
No i do not want to set it
so it would be api.x.com
r

rp

10/18/2022, 7:55 AM
yea.. then just make it
undefined
in prod
c

Chunkygoo

10/18/2022, 7:55 AM
right
so if it is api.x.com
my two backends sit behind api.x.com (api gateway)
r

rp

10/18/2022, 7:56 AM
yes
c

Chunkygoo

10/18/2022, 7:56 AM
the cookies should work right?
Cause they both run on https port 443?
I read a lot of articles and MDN ones about cookies
no one ever mentioned anything about ports though 🧐
r

rp

10/18/2022, 7:58 AM
yea.. cookies should work
c

Chunkygoo

10/18/2022, 7:59 AM
yeah
I wonder why
hmm