0

I am trying to set cookie from client side.

when I set cookie on webapp https://360.thesolarlabs.com/ for the domain .thesolarlabs.com like 'arka=test;domain=.thesolarlabs.com;path=/', cookie is set.

But when I do the same on webapp https://arka360-production-development.azurewebsites.net/

like 'arka=test;domain=.azurewebsites.net;path=/' for the domain .azurewebsites.net, cookie is NOT set.

What is the reason ?

EDIT: Found the reason. There is a list of domain names that you cannot create sub domain cookies against. https://learn.microsoft.com/en-us/answers/questions/360645/cannot-set-a-subdomain-friendly-cookie.html Chrome not sharing the cookie between the subdomains

srinivast6
  • 309
  • 3
  • 8

1 Answers1

0

Cookies cannot be set to a different domain than your current origin.\

Let's say you're generating a cookie form auth.domain_1.com you can only set the cookie to .domain_1.com but you cannot set cookie from auth.domain_1.com to .domain_2.com.

Moussa Bistami
  • 929
  • 5
  • 15
  • But I am setting cookie from https://arka360-production-development.azurewebsites.net/ on domain .azurewebsotes.net. Here domain and origin are same right? – srinivast6 Nov 09 '22 at 17:20