title: symfony route not working but showing in console router:debug
body: <p>I've added a route in my controller but it does not work even though i can see it in router:debug from the console.</p>
  
  <pre><code>/**
  * @Route("/apilucky", name="lucky")
  */
  public function numberAction(Request $request)
  {
    // returns '{"username":"jane.doe"}' and sets the proper Content-Type header
      return $this-&gt;json(array('username' =&gt; 'jane.doe'));
  }
  </code></pre>
  
  <p>I get a 404 message when i visit it from my browser or postman, but when I launch "php app/console router:debug " everything looks fine (carbon copy output from a existing/working route):</p>
  
  <p><a href="https://i.stack.imgur.com/4tmFC.png" rel="nofollow noreferrer">not working route</a></p>
  
  <p><a href="https://i.stack.imgur.com/B6pn2.png" rel="nofollow noreferrer">working route</a>
  (i had to do screenshots, formatting was not readable after copy/paste here)</p>
  
  <p>I'm new to symfony but this looks like an easy fix. Did I forget to clear/refresh anything ? (I tried running "php app/console clear:cache" but it did not help).</p>
  
  <hr>
  
  <p>edit:
  Cache was cleared on client as well.</p>
  
  <p>The address i'm trying to access is www.serverurl.fr/fr/apilucky</p>
  
  <p>The controller file is huge (there is a ton of other routes (i did not set them up) that are working, but here's an extract:</p>
  
  <pre><code>&lt;?php
  
  namespace App\CoreBundle\Controller;
  
  use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
  use Symfony\Component\HttpFoundation\Request;
  use Symfony\Component\HttpFoundation\Response;
  use Symfony\Component\HttpFoundation\JsonResponse;
  
  
  /**
   * @Route("/")
   */
  class WebviewController extends BaseController
  {
  // ...
      /**
   * @Route("/accounts", name="accounts")
   */
  public function AccountsAction(Request $request)
  {
      $accounts = $this-&gt;getDoctrine()-&gt;getManager()-&gt;getRepository('AppCoreBundle:Account')-&gt;findAll();
      $accountsArray = array();
  
      foreach ($accounts as $account) {
          $HasWeboob = $account-&gt;getWeboob();
          if ($HasWeboob) {
              $accountsArray[] = array(
                  'id_weboob' =&gt; $account-&gt;getWeboob(),
                  'account_name' =&gt; $account-&gt;getName(),
                  'account_id' =&gt; $account-&gt;getId(),
                  );
          }
      }
      return new JsonResponse($accountsArray);
  
  
   }
      /**
      * @Route("/apilucky", name="lucky")
      */
      public function numberAction(Request $request)
      {
        // returns '{"username":"jane.doe"}' and sets the proper Content-Type header
          return $this-&gt;json(array('username' =&gt; 'jane.doe'));
      }
  
  }
  </code></pre>
  
  <hr>
  
  <p>Thanks a lot.</p>
  
  <p>Cheers,
  Julien</p>
  
  <p><strong>SOLUTION:</strong></p>
  
  <p>I cleared the cache on the server side and it worked. 
  php app/console clear:cache --env=prod</p>