HowTo: Set up custom response headers on project levelEdit on GitHub
This document shows how to create customer response headers in your Spryker project. As an example, we use a header that allows playing full-screen videos in Chrome.
The purpose of this document is to illustrate the usage of
ShopApplicationTwigEventSubscriber::createResponse() to create custom headers.
The procedure described in this document is just an example of what you can do with the customer response headers, so you know where to adjust the headers for the other use cases.
Ensure that you have the following:
- Up-to-date Spryker installation
- Browser to test
- CMS page with the video in your Spryker-based shop
Set up custom response headers
- For the video example, change the
CmsControllerof the respective CMS page:
$response = new \Symfony\Component\HttpFoundation\Response(); $response->headers->set('Feature-Policy', 'fullscreen *'); $response->setContent( $this->renderView($localeCmsPageDataTransfer->getTemplatePath(), $viewData) ); return $response;
- Optional: to change the header response globally, edit
$response->headers->set('Feature-Policy', 'fullscreen *');
After this, you can see the video on the full screen.
For submitting the form