diff --git a/composer.json b/composer.json index 6678720c..0b87cb02 100644 --- a/composer.json +++ b/composer.json @@ -48,6 +48,7 @@ "dotkernel/dot-navigation": "^3.1", "dotkernel/dot-rbac": "^3.2", "dotkernel/dot-rbac-guard": "^3.1", + "dotkernel/dot-response-header": "^3.0", "dotkernel/dot-session": "^4.2", "dotkernel/dot-twigrenderer": "^3.1.1", "laminas/laminas-authentication": "^2.7", diff --git a/config/autoload/response-header.global.php b/config/autoload/response-header.global.php new file mode 100644 index 00000000..5573d2d0 --- /dev/null +++ b/config/autoload/response-header.global.php @@ -0,0 +1,27 @@ + [ + /** + * Global headers - applied to all routes + */ + '*' => [ + 'permissions-policy' => [ + 'value' => 'interest-cohort=()', + 'overwrite' => true, + ], + ], + + /** + * Route-specific headers + */ +// 'route-name' => [ +// 'header-name' => [ +// 'value' => 'header-value', +// 'overwrite' => true, +// ] +// ], + ] +]; diff --git a/config/config.php b/config/config.php index 6aeef667..f33d5a0f 100644 --- a/config/config.php +++ b/config/config.php @@ -40,6 +40,7 @@ class_exists(\Mezzio\Swoole\ConfigProvider::class) \Dot\FlashMessenger\ConfigProvider::class, \Dot\Rbac\ConfigProvider::class, \Dot\Rbac\Guard\ConfigProvider::class, + \Dot\ResponseHeader\ConfigProvider::class, // Default App module config \Frontend\App\ConfigProvider::class, diff --git a/config/pipeline.php b/config/pipeline.php index 0b7b8bfe..3f5df32c 100644 --- a/config/pipeline.php +++ b/config/pipeline.php @@ -3,7 +3,7 @@ declare(strict_types=1); use Dot\ErrorHandler\ErrorHandlerInterface; -use Laminas\Stratigility\Middleware\ErrorHandler; +use Dot\ResponseHeader\Middleware\ResponseHeaderMiddleware; use Mezzio\Application; use Mezzio\Handler\NotFoundHandler; use Mezzio\Helper\ServerUrlMiddleware; @@ -56,6 +56,7 @@ // Register the routing middleware in the middleware pipeline. // This middleware registers the Mezzio\Router\RouteResult request attribute. $app->pipe(RouteMiddleware::class); + $app->pipe(ResponseHeaderMiddleware::class);