This is an automated email from the ASF dual-hosted git repository.

kaxilnaik pushed a commit to branch v3-0-test
in repository https://gitbox.apache.org/repos/asf/airflow.git

commit 1a4ce7c4ecd2be48fb9560ace0d754a8f9bf10a4
Author: Amogh Desai <[email protected]>
AuthorDate: Wed Apr 23 09:49:03 2025 +0530

    Logout functionality should respect base_url in api server (#49545)
    
    (cherry picked from commit d17ca5c481beb984129737d2078834f95e24fecd)
---
 airflow-core/src/airflow/ui/src/layouts/Nav/LogoutModal.tsx | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/airflow-core/src/airflow/ui/src/layouts/Nav/LogoutModal.tsx 
b/airflow-core/src/airflow/ui/src/layouts/Nav/LogoutModal.tsx
index ba6ae08eca0..97b5e67cb35 100644
--- a/airflow-core/src/airflow/ui/src/layouts/Nav/LogoutModal.tsx
+++ b/airflow-core/src/airflow/ui/src/layouts/Nav/LogoutModal.tsx
@@ -31,8 +31,12 @@ const LogoutModal: React.FC<LogoutModalProps> = ({ isOpen, 
onClose }) => (
   <ConfirmationModal
     header="Logout"
     onConfirm={() => {
+      const baseHref = 
document.querySelector("head>base")?.getAttribute("href") ?? "";
+      const baseUrl = new URL(baseHref, globalThis.location.origin);
+      const logoutPath = new URL("api/v2/auth/logout", baseUrl).pathname;
+
       localStorage.removeItem(TOKEN_STORAGE_KEY);
-      globalThis.location.replace(`/api/v2/auth/logout`);
+      globalThis.location.replace(logoutPath);
     }}
     onOpenChange={onClose}
     open={isOpen}

Reply via email to