title: Symfony login unable to find controller for path login_check despite being behind firewall
body: <p>I am having this rather common problem of Symfony login failing with this error message:</p>
  
  <p><code>Unable to find the controller for path "/auth/login_check".</code></p>
  
  <p>The common answer to this problem is that the <code>login_check</code> route isn't behind the firewall, but in my case it is! Here are my config files:</p>
  
  <p><strong>app/config/security.yml</strong></p>
  
  <pre><code>firewalls:
      dev:
          pattern:    ^/(_(profiler|wdt)|css|images|js)/
          security:   false
  
      auth_area:
          pattern:    ^/auth/(login|login_check)
          anonymous:  ~
  
      secured_area:
          pattern:    ^/
          form_login:
              login_path: /auth/login
              check_path: /auth/login_check
          logout:
              path:   /auth/logout
              target: /
  </code></pre>
  
  <p><strong>app/config/routing.yml</strong></p>
  
  <pre><code>login:
      pattern: /auth/login
      defaults: { _controller: AuthBundle:Default:login }
  
  login_check:
      pattern: /auth/login_check
  
  logout:
      pattern: /auth/logout
  </code></pre>
  
  <p><strong>AuthBundle/Controller/DefaultController.php</strong></p>
  
  <pre><code>public function loginAction()
  {
    $form = $this-&gt;createForm(new UserType(), new User());
  
    return $this-&gt;render('AuthBundle:Default:login.html.twig', array(
      'form' =&gt; $form-&gt;createView(),
      'action' =&gt; $this-&gt;generateUrl('login_check'),
    ));
  }
  </code></pre>
  
  <p><strong>AuthBundle/Form/Type/UserType.php</strong></p>
  
  <pre><code>public function buildForm(FormBuilderInterface $builder, array $options)
  {
    $builder-&gt;add('username', 'text', array('label' =&gt; 'Login:'));
    $builder-&gt;add('password', 'password', array('label' =&gt; 'Password:'));
  }
  </code></pre>
  
  <p><strong>AuthBundle/Resources/views/Default/login.html.twig</strong></p>
  
  <pre><code>...
  &lt;form action="{{ action }}" method="POST"&gt;
    {{ form_widget(form) }}
    &lt;input type="submit" value="Login" /&gt;
  &lt;/form&gt;
  ...
  </code></pre>
  
  <p>My form is created with the route <code>login_check</code> as target (<code>/auth/login_check</code> URL).</p>
  
  <p>The <code>secured_area</code> firewall is supposed to match all URLs, so <code>/auth/login_check</code> should be in it. Yet, I keep getting this error. What am I doing wrong?</p>