Symfony2 error 500 instead of 404 at production

前端 未结 11 1220
野性不改
野性不改 2020-12-06 04:49

In my Symfony2 project I\'m getting at development mode correct 404 Exception screen. But I\'m getting blank screen with HTTP status code 500 instead of 404 at production mo

11条回答
  •  囚心锁ツ
    2020-12-06 05:10

    I had the same issue,

    But my isGranted was in the php side. So I added a token check :

    Before :

    if ($this->get('security.authorization_checker')->isGranted('IS_AUTHENTICATED_FULLY')
    

    After :

    if ($this->get('security.token_storage')->getToken() && $this->get('security.authorization_checker')->isGranted('IS_AUTHENTICATED_FULLY')
    

提交回复
热议问题