Skip to content

Commit 41e5793

Browse files
committed
set cookie domain attribute to the requested host
fixes app.thespaghettidetective.com access
1 parent 517f26d commit 41e5793

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

backend/app/middleware.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -79,14 +79,14 @@ def process_response(self, request, response):
7979
# This will set modified flag and update the cookie expiration time
8080
session['_session_expire_at_ts'] = now_ts + settings.SESSION_COOKIE_AGE
8181
response = super().process_response(request, response)
82-
# If setting a session cookie, ensure it is explicitly scoped to our domain so that it
82+
# If setting a session cookie, ensure we set the domain attribute so that the cookie
8383
# passes through to subdomains for tunneling
8484
if response.cookies:
8585
# Only update domain of our session cookie if domain is not set.
8686
# Does nothing if settings.SESSION_COOKIE_DOMAIN is configured.
8787
session_cookie = response.cookies.get(settings.SESSION_COOKIE_NAME, None)
8888
if session_cookie and not session_cookie.get('domain', ''):
89-
session_cookie['domain'] = str(get_current_site(request)).split(':')[0]
89+
session_cookie['domain'] = str(request.get_host()).split(':')[0]
9090
return response
9191

9292

0 commit comments

Comments
 (0)