Symfony route not working in production mode

Viewed 2937

A weird issue occurs when calling a action in a controller. In development-mode with the app_dev.php-prefix everything is working as expected. But in production mode the action returns with a 404.

An echo "test"; exit; at the beginning of the action is still resulting in a 404, so the action is completely ignored.

But app/console debug:router --env=prod as well as app/console debug:router --env=dev is displaying the routes correctly.

In both environments:

+--------------+---------------------------------------------------------+
| Property     | Value                                                   |
+--------------+---------------------------------------------------------+
| Route Name   | blabla_trackfile_index                                  |
| Path         | /trackfile/{id}.{ext}                                   |
| Path Regex   | #^/trackfile/(?P<id>[^/\.]++)\.(?P<ext>[^/]++)$#s       |
| Host         | ANY                                                     |
| Host Regex   |                                                         |
| Scheme       | ANY                                                     |
| Method       | ANY                                                     |
| Requirements | NO CUSTOM                                               |
| Class        | Symfony\Component\Routing\Route                         |
| Defaults     | _controller: PumukitBasePlayerBundle:TrackFile:index    |
| Options      | compiler_class: Symfony\Component\Routing\RouteCompiler |
+--------------+---------------------------------------------------------+

I already cleared the cache with console php app/console cache:clear php app/console cache:clear --env=prod and manually (deleting the folder).

I already changed the $kernel = new AppKernel('prod', false); in src/app.php to $kernel = new AppKernel('dev', true);, but the problem still persists in production mode.

Update

In prod.log are no entries.

Nginx log:

2017/07/06 10:19:29 [error] 1517#0: *159 open() "/var/www/test/web/trackfile/594b97d1e1db06824d8b4567.mp4" failed (2: No such file or directory), client: XX.XX.XX.XX, server: localhost, request: "GET /trackfile/594b97d1e1db06824d8$

So it looks like nginx is treating the requested route as a file or directory. Is this the problem? How can i fix this?

Update 2

/**
 * @Route("/trackfile/{id}.{ext}", name="blabla_trackfile_index" )
 */
public function indexAction($id, Request $request)
{
    echo "asdf"; exit;
}

Any other ideas or hints I can follow?

0 Answers
Related