From 990df95f3619859fff7063b8d69607cd40799036 Mon Sep 17 00:00:00 2001 From: Johannes Meyer Date: Wed, 4 Jul 2018 11:21:56 +0200 Subject: [PATCH 1/2] loader.js: Allow to force HTTP to be used for JS redirection --- public/js/icinga/loader.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/public/js/icinga/loader.js b/public/js/icinga/loader.js index d17465e09..a52ba9b56 100644 --- a/public/js/icinga/loader.js +++ b/public/js/icinga/loader.js @@ -343,6 +343,12 @@ } } + var useHttp = req.getResponseHeader('X-Icinga-Redirect-Http'); + if (useHttp === 'yes') { + window.location.replace(redirect); + return true; + } + this.redirectToUrl( redirect, req.$target, req.url, req.getResponseHeader('X-Icinga-Rerender-Layout'), req.forceFocus, req.getResponseHeader('X-Icinga-Refresh') From 1f677e64f6c554b08afd601577bfc5f3b54190dd Mon Sep 17 00:00:00 2001 From: Johannes Meyer Date: Wed, 4 Jul 2018 11:22:37 +0200 Subject: [PATCH 2/2] ActionController: Force HTTP redirects in method redirectHttp() That's what its name implies, right? The counterpart is redirectXhr(), which does still its job. redirectNow() on the other hand is for the lazy people. --- library/Icinga/Web/Controller/ActionController.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/library/Icinga/Web/Controller/ActionController.php b/library/Icinga/Web/Controller/ActionController.php index f5fded73d..680205902 100644 --- a/library/Icinga/Web/Controller/ActionController.php +++ b/library/Icinga/Web/Controller/ActionController.php @@ -424,6 +424,10 @@ class ActionController extends Zend_Controller_Action protected function redirectHttp($url) { + if ($this->isXhr()) { + $this->getResponse()->setHeader('X-Icinga-Redirect-Http', 'yes'); + } + $this->getResponse()->redirectAndExit($url); }