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

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


The following commit(s) were added to refs/heads/v3-1-test by this push:
     new 6ba77b8e3b7 [v3-1-test] Improve 404 handling by adding fallback route 
for invalid URLs (#58546) (#58629)
6ba77b8e3b7 is described below

commit 6ba77b8e3b7f56e8efaa9fcb3f8e20bd2a240541
Author: github-actions[bot] 
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Tue Nov 25 11:46:16 2025 +0100

    [v3-1-test] Improve 404 handling by adding fallback route for invalid URLs 
(#58546) (#58629)
    
    * Add error handling route to catch unmatched paths
    
    * Add custom 404 error message for invalid URLs
    (cherry picked from commit 946871c27de7b7e72abad646ffbd65b163d98139)
    
    Co-authored-by: Yeonguk Choo <[email protected]>
---
 airflow-core/src/airflow/ui/public/i18n/locales/en/common.json | 1 +
 airflow-core/src/airflow/ui/src/pages/Error.tsx                | 5 ++++-
 airflow-core/src/airflow/ui/src/router.tsx                     | 4 ++++
 3 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/airflow-core/src/airflow/ui/public/i18n/locales/en/common.json 
b/airflow-core/src/airflow/ui/public/i18n/locales/en/common.json
index 211244bd684..8aee7cb16de 100644
--- a/airflow-core/src/airflow/ui/public/i18n/locales/en/common.json
+++ b/airflow-core/src/airflow/ui/public/i18n/locales/en/common.json
@@ -89,6 +89,7 @@
     "back": "Back",
     "defaultMessage": "An unexpected error occurred",
     "home": "Home",
+    "invalidUrl": "Page Not Found. Please check the URL and try again.",
     "notFound": "Page Not Found",
     "title": "Error"
   },
diff --git a/airflow-core/src/airflow/ui/src/pages/Error.tsx 
b/airflow-core/src/airflow/ui/src/pages/Error.tsx
index 7b9ee1b8a39..28fa9ec84af 100644
--- a/airflow-core/src/airflow/ui/src/pages/Error.tsx
+++ b/airflow-core/src/airflow/ui/src/pages/Error.tsx
@@ -30,7 +30,10 @@ export const ErrorPage = () => {
   let errorMessage = translate("error.defaultMessage");
   let statusCode = "";
 
-  if (isRouteErrorResponse(error)) {
+  if (error === null || error === undefined) {
+    statusCode = "404";
+    errorMessage = translate("error.invalidUrl");
+  } else if (isRouteErrorResponse(error)) {
     statusCode = String(error.status);
     errorMessage =
       ((error as unknown as Error).message || (error as { statusText?: string 
}).statusText) ??
diff --git a/airflow-core/src/airflow/ui/src/router.tsx 
b/airflow-core/src/airflow/ui/src/router.tsx
index 052096eaa1d..5c3ddc76174 100644
--- a/airflow-core/src/airflow/ui/src/router.tsx
+++ b/airflow-core/src/airflow/ui/src/router.tsx
@@ -227,6 +227,10 @@ export const routerConfig = [
         element: <Task />,
         path: "dags/:dagId/tasks/:taskId",
       },
+      {
+        element: <ErrorPage />,
+        path: "*",
+      },
     ],
     element: <BaseLayout />,
     errorElement: (

Reply via email to