Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions airflow-core/newsfragments/63141.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix security iframe navigation when AIRFLOW__API__BASE_URL basename is configured
Comment thread
pierrejeambrun marked this conversation as resolved.
11 changes: 7 additions & 4 deletions airflow-core/src/airflow/ui/src/pages/Security.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand All @@ -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("/");
}
}
Comment thread
bbovenzi marked this conversation as resolved.
};

Expand Down
Loading