Symfony: cookies get lost in iframe in Internet Explorer

January 21, 2015 at 15:54

I have a form with an iframe target. The called url is the login_check in Symfony, to which I send _username and _password, to instantly log in. The problem: the Internet Explorer loses the cookies in an iframe. So I had to add a header which I do by adding a listener:
namespace Package\SomeBundle\EventListener;

use Symfony\Component\HttpKernel\Event\FilterResponseEvent;

class ResponseListener{
    public function onKernelResponse(FilterResponseEvent $event){
        $event->getResponse()->headers->set('P3P', 'CP="IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT"');
This Listener is registered in services.yml:
        class: Package\SomeBundle\EventListener\ResponseListener
            - {name: kernel.event_listener, event: kernel.response, method: onKernelResponse}

Tags: Header IE Listener p3p

Hinterlasse einen Kommentar: