From 0537f250c2d877739b0641fdd68d84dd2e12d53c Mon Sep 17 00:00:00 2001 From: Subham Date: Thu, 12 Mar 2026 20:40:07 +0530 Subject: [PATCH 1/2] [v3-1-test] Fix regression in security iframe navigation logic with basename (#63141) * Fix regression in security iframe navigation logic with basename * style: apply formatting to Security.tsx * fix(ui): remove hardcoded localhost fallback from Security iframe navigation * Add newsfragment for security iframe basename fix * Address review feedback: simplify security iframe navigation logic and handle basename (cherry picked from commit 8653aa84ff4d330eecae2435a69de207de54502d) Co-authored-by: Subham --- airflow-core/newsfragments/63141.bugfix.rst | 1 + airflow-core/src/airflow/ui/src/pages/Security.tsx | 11 +++++++---- 2 files changed, 8 insertions(+), 4 deletions(-) create mode 100644 airflow-core/newsfragments/63141.bugfix.rst diff --git a/airflow-core/newsfragments/63141.bugfix.rst b/airflow-core/newsfragments/63141.bugfix.rst new file mode 100644 index 0000000000000..c9855b3f5e49b --- /dev/null +++ b/airflow-core/newsfragments/63141.bugfix.rst @@ -0,0 +1 @@ +Fix security iframe navigation when AIRFLOW__API__BASE_URL basename is configured diff --git a/airflow-core/src/airflow/ui/src/pages/Security.tsx b/airflow-core/src/airflow/ui/src/pages/Security.tsx index 011c101868697..c3b0fb89309d4 100644 --- a/airflow-core/src/airflow/ui/src/pages/Security.tsx +++ b/airflow-core/src/airflow/ui/src/pages/Security.tsx @@ -17,8 +17,7 @@ * under the License. */ import { Box } from "@chakra-ui/react"; -import { useParams } from "react-router-dom"; -import { useNavigate } from "react-router-dom"; +import { useNavigate, useParams } from "react-router-dom"; import { useAuthLinksServiceGetAuthMenus } from "openapi/queries"; import { ProgressBar } from "src/components/ui"; @@ -43,8 +42,12 @@ export const Security = () => { const onLoad = () => { const iframe: HTMLIFrameElement | null = document.querySelector("#security-iframe"); - if (iframe?.contentWindow && !iframe.contentWindow.location.pathname.startsWith("/auth/")) { - void Promise.resolve(navigate("/")); + if (iframe?.contentWindow) { + const base = new URL(document.baseURI).pathname.replace(/\/$/u, ""); // Remove trailing slash if exists + + if (!iframe.contentWindow.location.pathname.startsWith(`${base}/auth/`)) { + void navigate("/"); + } } }; From ea99ac271463ba54da0833bf79a012e60b7c8d3d Mon Sep 17 00:00:00 2001 From: Pierre Jeambrun Date: Mon, 16 Mar 2026 11:33:19 +0100 Subject: [PATCH 2/2] Delete airflow-core/newsfragments/63141.bugfix.rst --- airflow-core/newsfragments/63141.bugfix.rst | 1 - 1 file changed, 1 deletion(-) delete mode 100644 airflow-core/newsfragments/63141.bugfix.rst diff --git a/airflow-core/newsfragments/63141.bugfix.rst b/airflow-core/newsfragments/63141.bugfix.rst deleted file mode 100644 index c9855b3f5e49b..0000000000000 --- a/airflow-core/newsfragments/63141.bugfix.rst +++ /dev/null @@ -1 +0,0 @@ -Fix security iframe navigation when AIRFLOW__API__BASE_URL basename is configured