diff --git a/actions/DisplayAction.php b/actions/DisplayAction.php index fc5e9da09bc..89930cfbe6a 100644 --- a/actions/DisplayAction.php +++ b/actions/DisplayAction.php @@ -12,6 +12,15 @@ */ class DisplayAction extends ActionAbstract { + private function get_return_code($error) { + $returnCode = $error->getCode(); + if ($returnCode === 301 || $returnCode === 302) { + # Don't pass redirect codes to the exterior + $returnCode = 508; + } + return $returnCode; + } + public function execute() { $bridge = array_key_exists('bridge', $this->userData) ? $this->userData['bridge'] : null; @@ -181,7 +190,7 @@ public function execute() { $items[] = $item; } elseif(Configuration::getConfig('error', 'output') === 'http') { - header('Content-Type: text/html', true, $e->getCode()); + header('Content-Type: text/html', true, get_return_code($e)); die(buildTransformException($e, $bridge)); } } @@ -213,7 +222,7 @@ public function execute() { $items[] = $item; } elseif(Configuration::getConfig('error', 'output') === 'http') { - header('Content-Type: text/html', true, $e->getCode()); + header('Content-Type: text/html', true, get_return_code($e)); die(buildTransformException($e, $bridge)); } }