0

I'm using express and using ngrok to test my server so I have a URL like a846d0979b95.ngrok.io. In express I'm trying to set a cookie so that the domain property is ".ngrok.io" and not "a846d0979b95.ngrok.io" to set the cookie on the domain and not on the subdomain.

response.cookie('test-cookie', '1234', {
    domain: '.ngrok.io'
})

Although on chrome dev tools the cookie is not accepted. Chrome gives the error This Set-Cookie was blocked because its Domain attribute is invalid with regards to the current host URL

enter image description here

Note:

I can set the cookies for a846d0979b95.ngrok.io with the default domain "a846d0979b95.ngrok.io" with no problem

MrBrN197
  • 663
  • 4
  • 13
  • See https://stackoverflow.com/a/52475993/529282 ngrok.io is indeed defined in https://publicsuffix.org/list/public_suffix_list.dat – Martheen Apr 11 '21 at 02:48
  • Does this answer your question? [Chrome not sharing the cookie between the subdomains](https://stackoverflow.com/questions/42419074/chrome-not-sharing-the-cookie-between-the-subdomains) – Martheen Apr 11 '21 at 02:49
  • @Martheen I can set cookies on ngrok no problem. those are accepted and stay there. what I can't do is set a cookie 's property to `.ngrok.io`. the request URL is .ngrok.io and it returns a cookie whose domain is supposed to be .ngrok.io ( the parent domain) that's what fails. – MrBrN197 Apr 11 '21 at 02:56

0 Answers0