Make the CSP compatible with debug tools
This commit is contained in:
parent
e2560cd9cb
commit
561b6c8370
6 changed files with 194 additions and 2 deletions
|
@ -6,6 +6,7 @@
|
|||
|
||||
namespace Alltube\Controller;
|
||||
|
||||
use Alltube\CspMiddleware;
|
||||
use Alltube\Library\Exception\PasswordException;
|
||||
use Alltube\Library\Exception\AlltubeLibraryException;
|
||||
use Alltube\Library\Exception\WrongPasswordException;
|
||||
|
@ -295,6 +296,12 @@ class FrontController extends BaseController
|
|||
{
|
||||
$this->logger->error($error);
|
||||
|
||||
// We apply the CSP manually because middlewares are not called on error pages.
|
||||
$cspMiddleware = new CspMiddleware($this->container);
|
||||
|
||||
/** @var Response $response */
|
||||
$response = $cspMiddleware->applyHeader($response);
|
||||
|
||||
if ($this->config->debug) {
|
||||
$renderer = new HtmlErrorRenderer(true);
|
||||
$exception = $renderer->render($error);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue