I’ve exactly the same problem:
On Symfony 2, losing session with iframe on IE
$response->headers->set('P3P', 'CP="IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT"');
But i’ve a lot of action and i use automatic template:
/**
* @Route("/", name="_welcome")
* @Template()
*/
public function indexAction()
{
....
return array(...);
}
So is it possible to define header in all actions…
You can create an event listener for the response.
Here you find an example for this using the Acme Bundle that ships with Symfony2:
http://php-and-symfony.matthiasnoback.nl/2011/10/symfony2-create-a-response-filter-and-set-extra-response-headers/
Basically you would adapt this example and write: