How to set cookies for all subdomains
By default the subdomain cookie sharing is not possible. But its possible to share cookies between subdomains though some configuration changes.
In-order to achieve this, specify the cookie's domain in your header in the following way.
Set-Cookie: name=value; domain=.mydomain.com
Please note the '.' before the domain which makes the cookie available throughout any subdomain.