zend framework2 - How do I send the same header with every response in zf2? -
i send header "x-content-type-options: nosniff" every response in zend framework 2 application. how can without explicitly coding in every single controller method?
you can modify response object via bootstrap:
module.php
/** * on bootstrap event * * @param \zend\mvc\mvcevent $e */ public function onbootstrap(mvcevent $e) { $headers = $e->getresponse()->getheaders(); $headers->addheaderline('x-content-type-options: nosniff'); }