From b6637d667a3cdf8e2b44195559e8a41820fd89fe Mon Sep 17 00:00:00 2001 From: ryoya-hayase Date: Mon, 6 Oct 2025 19:50:28 +0900 Subject: [PATCH 1/2] set cookies during login process --- nginx/login.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/nginx/login.py b/nginx/login.py index 558ca83c28..35c6122603 100644 --- a/nginx/login.py +++ b/nginx/login.py @@ -56,6 +56,8 @@ print('HTTP/1.1 302 Found') print('Content-Type: text/html') print('Location: ' + base_url + redirect) + for cookie in response.cookies: + print(f'Set-Cookie: {cookie.name}={cookie.value}; Path=/; HttpOnly') print('') else: # Display the login page or the page before login processing with flash message From bc7e17a09bd461e71bf1c51129bdcc5fb154a8b7 Mon Sep 17 00:00:00 2001 From: ryoya-hayase Date: Thu, 25 Dec 2025 14:23:30 +0900 Subject: [PATCH 2/2] fix: address review comments --- nginx/login.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/nginx/login.py b/nginx/login.py index 35c6122603..471ad2f62d 100644 --- a/nginx/login.py +++ b/nginx/login.py @@ -51,13 +51,21 @@ response.raise_for_status() redirect = response.text + # Get Set-Cookie headers + set_cookie_values = [] + try: + set_cookie_values = response.raw.headers.getlist('Set-Cookie') + except Exception: + set_cookie_values = [response.headers.get('Set-Cookie')] + if redirect.startswith('/'): # Redirect to the Shibboleth login print('HTTP/1.1 302 Found') print('Content-Type: text/html') print('Location: ' + base_url + redirect) - for cookie in response.cookies: - print(f'Set-Cookie: {cookie.name}={cookie.value}; Path=/; HttpOnly') + for set_cookie in set_cookie_values: + if set_cookie: + print(f'Set-Cookie: {set_cookie}') print('') else: # Display the login page or the page before login processing with flash message