aliotta commented on code in PR #64333:
URL: https://github.com/apache/airflow/pull/64333#discussion_r3003077212
##########
airflow-core/src/airflow/ui/src/main.tsx:
##########
@@ -48,6 +48,23 @@ Reflect.set(globalThis, "ReactRouterDOM", ReactRouterDOM);
Reflect.set(globalThis, "ChakraUI", ChakraUI);
Reflect.set(globalThis, "EmotionReact", EmotionReact);
+// URLs that returned 403 Forbidden. Permissions won't change mid-session,
+// so we block further requests to avoid spamming the server with polling.
+const forbidden403Urls = new Set<string>();
+
+// Block outgoing requests to URLs that previously returned 403.
+// The request is aborted immediately so no network traffic occurs.
+axios.interceptors.request.use((config) => {
+ if (config.url !== undefined && forbidden403Urls.has(config.url)) {
+ const controller = new AbortController();
+
+ controller.abort();
+ config.signal = controller.signal;
+ }
+
+ return config;
+});
+
// redirect to login page if the API responds with unauthorized or forbidden
errors
axios.interceptors.response.use(
Review Comment:
thoughts o
##########
airflow-core/src/airflow/ui/src/main.tsx:
##########
@@ -48,6 +48,23 @@ Reflect.set(globalThis, "ReactRouterDOM", ReactRouterDOM);
Reflect.set(globalThis, "ChakraUI", ChakraUI);
Reflect.set(globalThis, "EmotionReact", EmotionReact);
+// URLs that returned 403 Forbidden. Permissions won't change mid-session,
+// so we block further requests to avoid spamming the server with polling.
+const forbidden403Urls = new Set<string>();
+
+// Block outgoing requests to URLs that previously returned 403.
+// The request is aborted immediately so no network traffic occurs.
+axios.interceptors.request.use((config) => {
+ if (config.url !== undefined && forbidden403Urls.has(config.url)) {
+ const controller = new AbortController();
+
+ controller.abort();
+ config.signal = controller.signal;
+ }
+
+ return config;
+});
+
// redirect to login page if the API responds with unauthorized or forbidden
errors
axios.interceptors.response.use(
Review Comment:
thoughts o
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]