title: Symfony2: prod not found 404 = 200?
body: <p>In the prod environment when a nonexistent URI (e.g., .../green) is requested I'd expect the custom 404 error page to be rendered.  The response header is </p>
  
  <pre><code>Date: Sat, 16 Nov 2013 19:11:55 GMT
  Server: Apache/2.4.4 (Win32) PHP/5.4.8
  X-Powered-By: PHP/5.4.16
  Content-Length: 2455
  Keep-Alive: timeout=5, max=100
  Connection: Keep-Alive
  Content-Type: text/html
  
  200 OK
  </code></pre>
  
  <p>and the response is </p>
  
  <pre><code>Fatal error: Uncaught exception 'Symfony\Component\Routing\Exception\ResourceNotFoundException' in G:\Documents\workspace\sym\app\cache\prod\classes.php on line 1883 Symfony\Component\Routing\Exception\ResourceNotFoundException: in G:\Documents\workspace\sym\app\cache\prod\appProdUrlMatcher.php on line 1682 Call Stack: 0.0000 130880 1. {main}() G:\Documents\workspace\sym\web\app.php:0 0.0200 340984 2. Symfony\Component\HttpKernel\Kernel-&gt;handle() G:\Documents\workspace\sym\web\app.php:21 0.1800 2659792 3. Symfony\Component\HttpKernel\DependencyInjection\ContainerAwareHttpKernel-&gt;handle() G:\Documents\workspace\sym\app\bootstrap.php.cache:2249 0.1800 2661000 4. Symfony\Component\HttpKernel\HttpKernel-&gt;handle() G:\Documents\workspace\sym\app\bootstrap.php.cache:2947 0.1800 2661032 5. Symfony\Component\HttpKernel\HttpKernel-&gt;handleRaw() G:\Documents\workspace\sym\app\bootstrap.php.cache:2818 0.1800 2661576 6. Symfony\Component\EventDispatcher\ContainerAwareEventDispatcher-&gt;dispatch() G:\Documents\workspace\sym\app\bootstrap.php.cache:2833 0.4900 4232624 7. Symfony\Component\EventDispatcher\EventDispatcher-&gt;dispatch() G:\Documents\workspace\sym\app\cache\prod\classes.php:1764 0.4900 4233384 8. Symfony\Component\EventDispatcher\EventDispatcher-&gt;doDispatch() G:\Documents\workspace\sym\app\cache\prod\classes.php:1600 0.4900 4234080 9. call_user_func() G:\Documents\workspace\sym\app\cache\prod\classes.php:1667 0.4900 4234096 10. Symfony\Component\HttpKernel\EventListener\RouterListener-&gt;onKernelRequest() G:\Documents\workspace\sym\app\cache\prod\classes.php:1667 0.4900 4234360 11. Symfony\Component\Routing\Router-&gt;match() G:\Documents\workspace\sym\app\cache\prod\classes.php:1872 0.4900 4238400 12. appProdUrlMatcher-&gt;match() G:\Documents\workspace\sym\app\cache\prod\classes.php:1207 Symfony\Component\HttpKernel\Exception\NotFoundHttpException: No route found for "GET /green" in G:\Documents\workspace\sym\app\cache\prod\classes.php on line 1883 Call Stack: 0.0000 130880 1. {main}() G:\Documents\workspace\sym\web\app.php:0 0.0200 340984 2. Symfony\Component\HttpKernel\Kernel-&gt;handle() G:\Documents\workspace\sym\web\app.php:21 0.1800 2659792 3. Symfony\Component\HttpKernel\DependencyInjection\ContainerAwareHttpKernel-&gt;handle() G:\Documents\workspace\sym\app\bootstrap.php.cache:2249 
  </code></pre>
  
  <p>The more I try to understand this the more confused I get.  Documentation says that a simple <code>error404.html.twig</code> in <code>app\Resources\TwigBundle\views\Exception</code> will be rendered.  (Yes, I've cleared the prod cache - multiple times!  No entries in prod log.)  Is the documentation wrong and I really do need to create an exception handler just to show this 404 page because the response is a 200?  </p>
  
  <h3>Update:</h3>
  
  <p>So I guess a 404 in the dev environment doesn't mean it'll be a 404 in prod.  I then attempted a simple exception handler to get a custom error page, but then no Monolog mail.  Attempts to integrate the custom handler with Monolog results in the following because the custom handler uses Twig.  No wonder my head is spinning.</p>
  
  <pre><code>[Symfony\Component\DependencyInjection\Exception\ServiceCircularReferenceException] Circular reference detected for service "router", path: "cache_warmer -&gt; router -&gt; monolog.logger.router -&gt; mana.exception.controller -&gt; templating -&gt; twig -&gt; templating.helper.logout_url".
  </code></pre>