title: kernel.request event setResponse to RedirectResponse not working
body: <p>I am trying to use the kernel.request event found <a href="http://symfony.com/doc/current/components/http_kernel/introduction.html#the-kernel-request-event" rel="nofollow">here</a> </p>
  
  <p>A simplified version of my example is to redirect the user unless if they are already on the redirected page. The problem I am seeing is that I am getting a page without any styles - it seems like my styles and js might be redirected as well.</p>
  
  <p>Here is the code</p>
  
  <p>services.yml</p>
  
  <pre><code>services:
      app.RequestListener:
          class: App\EventListener\RequestListener
          arguments: [ @security.context ]
          tags:
            - { name: kernel.event_listener, event: kernel.request, method: redirectUser }
  </code></pre>
  
  <p>requestListener.php</p>
  
  <pre><code>class requestListener
  {
     public function redirectUser()
     {
        if($event-&gt;getRequest()-&gt;getPathInfo() != '/') {
           //app_frontend_home_index goes to '/'
           $event-&gt;setResponse(new RedirectResponse($this-&gt;router-&gt;generate('app_frontend_home_index')));
        }
     }
  }
  </code></pre>
  
  <p>I have also tried this where I set ?test=dont_redirect and once that is set it should not redirect</p>
  
  <pre><code>   public function redirectUser()
     {
        if(is_null($event-&gt;getRequest()-&gt;get('test'))) {
           //app_frontend_home_index goes to '/'
           $event-&gt;setResponse(new RedirectResponse($this-&gt;router-&gt;generate('app_frontend_home_index', array('test' =&gt; 'dont_redirect'))));
        }
     }
  </code></pre>
  
  <p>After reading over the section in the link I provided - it sounds like this is the correct event to use. Is there a way to make it work?</p>