EventListener/ResponseListener.php
public function onKernelResponse(FilterResponseEvent $event)
    {
        $response = $event->getResponse();

        $response->headers->set('Access-Control-Allow-Origin', '*');
        $response->headers->set('Access-Control-Allow-Credentials', 'true');
        $response->headers->set('Access-Control-Expose-Headers', 'Link');
        $response->headers->set('Access-Control-Allow-Methods', 'GET, POST, PUT, DELETE');

        $response->headers->set(
            'Link',
            '<' . $this->hydra->getDocumentationUrl() . '>; rel="http://www.w3.org/ns/hydra/core#apiDocumentation"'
        );
    }
public function onKernelResponse(FilterResponseEvent $event)
    {
        $response = $event->getResponse();

        $response->headers->set('Access-Control-Allow-Origin', '*');
        $response->headers->set('Access-Control-Allow-Credentials', 'true');
        $response->headers->set('Access-Control-Expose-Headers', 'Link');
        $response->headers->set('Access-Control-Allow-Methods', 'GET, POST, PUT, DELETE');

        $response->headers->set(
            'Link',
            '<' . $this->hydra->getDocumentationUrl() . '>; rel="http://www.w3.org/ns/hydra/core#apiDocumentation"'
        );
    }
Marks request that whose controller return value should be serialized
by the Hydra serializer

@param FilterControllerEvent $event A FilterControllerEvent instance