# \[Feature Reuest\] Auth Cookie Domain change/override

**URL:** <https://forum.pritunl.com/t/feature-reuest-auth-cookie-domain-change-override/3084>\
**Category:** Pritunl Zero\
**Created:** [March 1, 2025, 1:50pm UTC](https://forum.pritunl.com/t/feature-reuest-auth-cookie-domain-change-override/3084 "2025-03-01T13:50:16Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![karawedi](https://forum.pritunl.com/user_avatar/forum.pritunl.com/karawedi/32/594_2.png) [@karawedi](https://forum.pritunl.com/u/karawedi)\
**Post date:** [March 1, 2025, 1:50pm UTC](https://forum.pritunl.com/t/feature-reuest-auth-cookie-domain-change-override/3084/1 "2025-03-01T13:50:16Z")

</div>

Hi all! I have a feature request to make for Pritunl zero.

As of now, every service i authenticate against creates a new Cookie. I’d appreciate manually setting the domain field of the cookie in order to make sessions transferable between subdomains.

The Cookie domain needs to begin with “.” so i.e. “.example.com” in order follow rfc6265 Chapter 5.1.3 Domain Matching.

I was able to reproduce this by manually manipulating the cookie domain and prefixing the needed “.”. You can successfully transfer the zero-trust session between services.

This would make everything a lot easier since the user is allowed to authenticate once at the root-domain and then open any successing site without authenticating again.

In this specific use-case, the root domain contains a Launchpad, following services are a subdomain.

Do you think you can implement this, or make it configurable from the ui?

---

<div class="post-metadata">

**Author:** ![zach](https://forum.pritunl.com/user_avatar/forum.pritunl.com/zach/32/1105_2.png) [@zach](https://forum.pritunl.com/u/zach)\
**Post date:** [March 1, 2025, 6:53pm UTC](https://forum.pritunl.com/t/feature-reuest-auth-cookie-domain-change-override/3084/2 "2025-03-01T18:53:02Z")

</div>

This should already happen and there is an option labeled _Share session with subdomains_ in the service settings. The code is in [**pritunl-zero/cookie/utils.go**](https://github.com/pritunl/pritunl-zero/blob/master/cookie/utils.go#L123). It only goes up one domain level, so `service.test.pritunl.com` would become `.test.pritunl.com` and `service.pritunl.com` would become `.pritunl.com`.

---

<div class="post-metadata">

**Author:** ![zach](https://forum.pritunl.com/user_avatar/forum.pritunl.com/zach/32/1105_2.png) [@zach](https://forum.pritunl.com/u/zach)\
**Post date:** [March 1, 2025, 7:13pm UTC](https://forum.pritunl.com/t/feature-reuest-auth-cookie-domain-change-override/3084/3 "2025-03-01T19:13:29Z")

</div>

I have added the option `sudo pritunl-zero set router root_domain_cookie true` to support using the root domain for the cookie to share the session over all subdomains.

---

<div class="post-metadata">

**Author:** ![karawedi](https://forum.pritunl.com/user_avatar/forum.pritunl.com/karawedi/32/594_2.png) [@karawedi](https://forum.pritunl.com/u/karawedi)\
**Post date:** [March 1, 2025, 8:34pm UTC](https://forum.pritunl.com/t/feature-reuest-auth-cookie-domain-change-override/3084/4 "2025-03-01T20:34:37Z")

</div>

Hi Zach, thanks for the reply and the code change!

Maybe I’m missing something or I have a heavily misconfigured Instance.

Your first response said (and i could also verify this by looking at your code), that with the “share with subdomain” function, the session-cookie already should be prefixed with “.” and move to it’s parent?

i.e. if I access [xy.example.com](http://xy.example.com), the cookie should be “.example.com” even without your current change?

If so, this is not working for me as of now. Is there any other configuration conflicting with those options (policies or something)? Or has having the cookie point to the root-domain been generally disallowed by your current implementation?

Either way, thanks for your implementation. Appreciate it.

---

<div class="post-metadata">

**Author:** ![zach](https://forum.pritunl.com/user_avatar/forum.pritunl.com/zach/32/1105_2.png) [@zach](https://forum.pritunl.com/u/zach)\
**Post date:** [March 1, 2025, 9:07pm UTC](https://forum.pritunl.com/t/feature-reuest-auth-cookie-domain-change-override/3084/5 "2025-03-01T21:07:05Z")

</div>

That may be an issue with security settings in the browser or extensions.
