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

rmetzger pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/flink.git


The following commit(s) were added to refs/heads/master by this push:
     new ded2df542fd [FLINK-29363] allow fully redirection in web dashboard
ded2df542fd is described below

commit ded2df542fd5d585842e77d021fb84a92a5bea76
Author: Zhenqiu Huang <hpe...@apple.com>
AuthorDate: Wed Sep 21 08:06:38 2022 -0700

    [FLINK-29363] allow fully redirection in web dashboard
    
    This closes #20875
---
 .../web-dashboard/src/app/app.interceptor.ts          | 19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)

diff --git a/flink-runtime-web/web-dashboard/src/app/app.interceptor.ts 
b/flink-runtime-web/web-dashboard/src/app/app.interceptor.ts
index 92c86f94b46..567d0cf1981 100644
--- a/flink-runtime-web/web-dashboard/src/app/app.interceptor.ts
+++ b/flink-runtime-web/web-dashboard/src/app/app.interceptor.ts
@@ -16,7 +16,14 @@
  * limitations under the License.
  */
 
-import { HttpEvent, HttpHandler, HttpInterceptor, HttpRequest } from 
'@angular/common/http';
+import {
+  HttpEvent,
+  HttpHandler,
+  HttpInterceptor,
+  HttpRequest,
+  HttpResponseBase,
+  HttpStatusCode
+} from '@angular/common/http';
 import { Injectable, Injector } from '@angular/core';
 import { Observable, throwError } from 'rxjs';
 import { catchError } from 'rxjs/operators';
@@ -39,6 +46,16 @@ export class AppInterceptor implements HttpInterceptor {
 
     return next.handle(req.clone({ withCredentials: true })).pipe(
       catchError(res => {
+        if (
+          res instanceof HttpResponseBase &&
+          (res.status == HttpStatusCode.MovedPermanently ||
+            res.status == HttpStatusCode.TemporaryRedirect ||
+            res.status == HttpStatusCode.SeeOther) &&
+          res.headers.has('Location')
+        ) {
+          window.location.href = String(res.headers.get('Location'));
+        }
+
         const errorMessage = res && res.error && res.error.errors && 
res.error.errors[0];
         if (
           errorMessage &&

Reply via email to