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'); } 

Popular posts from this blog

Php - Delimiter must not be alphanumeric or backslash -

c# - How to change the "Applies To" field under folder auditing options programatically (.NET) -

c++ - Ambiguity when using boost::assign::list_of to construct a std::vector -