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

How to calculate SNR of signals in MATLAB? -

c# - Attempting to upload to FTP: System.Net.WebException: System error -

ios - UISlider customization: how to properly add shadow to custom knob image -