# local development with cookies using domain name

**URL:** <https://forum.djangoproject.com/t/local-development-with-cookies-using-domain-name/32685>\
**Category:** Using Django\
**Created:** [July 4, 2024, 9:44am UTC](https://forum.djangoproject.com/t/local-development-with-cookies-using-domain-name/32685 "2024-07-04T09:44:32Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![comiconomenclaturist](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/comiconomenclaturist/32/10856_2.png) [@comiconomenclaturist](https://forum.djangoproject.com/u/comiconomenclaturist)\
**Post date:** [July 4, 2024, 9:44am UTC](https://forum.djangoproject.com/t/local-development-with-cookies-using-domain-name/32685/1 "2024-07-04T09:44:32Z")

</div>

I have a staging server with the domain name [staging.example.com](http://staging.example.com) that issues CloudFront cookies for protected content with `set_cookie`, but I want to develop the app locally on localhost.

The cookies are issued for the domain [stream.example.com](http://stream.example.com), so they are both subdomains of the main domain.

The problem is the cookies are not sent when using localhost. I’ve tried changing /etc/hosts so that staging server routes to 127.0.0.1 and added the domain to ALLOWED\_HOSTS, but Django now refuses to allow logins.

Is there a way I can get these cookies to work locally?

---

<div class="post-metadata">

**Author:** ![joshyt100](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/joshyt100/32/27449_2.png) [@joshyt100](https://forum.djangoproject.com/u/joshyt100)\
**Post date:** [March 12, 2025, 7:26pm UTC](https://forum.djangoproject.com/t/local-development-with-cookies-using-domain-name/32685/2 "2025-03-12T19:26:19Z")

</div>

Did you figure it out?
