Symfony-404始终重定向到登录页面,而不是显示自定义404页面

问题描述

|| 我遇到了一个很奇怪的问题。 认情况下,我的整个应用程序是安全的(在apps / frontend / config / security.yml文件中) 在我的设置中,我已经删除了csrf令牌,check_lock等,因为它们不相关):
all:
  .settings:
    error_404_module: user
    error_404_action: 404
    use_security: on
    login_module: user
    login_action: login
用户模块的security.yml文件中,我具有:
404Success:
  is_secure: false
在开发中,如果我转到无效的URL,我将得到标准的symfony调试页面,其中显示
404 | Not Found | sfError404Exception
Empty module and/or action after parsing the URL
     \“ / blahblahfhfjhjdhdshdus \”(/)。 但是,在生产中,将为我显示每个无效URL的登录页面。 我只想显示我的自定义404错误页面。 我已经查看了PHP错误日志,这是我看到的内容
> [Tue Jun 14 17:10:54 2011] [error]
> [client 129.42.32.32] Empty module
> and/or action after parsing the URL
> \"//blahblahfhfjhjdhdshdus\" (/). [Tue
> Jun 14 17:10:54 2011] [error] [client
> 129.42.32.32] PHP Fatal error:  Uncaught exception \'sfStopException\'
> in
> /srv/www/foo.bar/lib/vendor/symfony/1.4/lib/filter/sfBasicSecurityFilter.class.PHP:96\\nStack
> trace:\\n#0
> /srv/www/foo.bar/lib/vendor/symfony/1.4/lib/filter/sfBasicSecurityFilter.class.PHP(55):
> sfBasicSecurityFilter->forwardToLoginAction()\\n#1
> /srv/www/foo.bar/cache/frontend/prod/config/config_core_compile.yml.PHP(1026):
> sfBasicSecurityFilter->execute(Object(sfFilterChain))\\n#2
> /srv/www/foo.bar/cache/frontend/prod/config/config_core_compile.yml.PHP(990):
> sfFilterChain->execute()\\n#3
> /srv/www/foo.bar/cache/frontend/prod/config/config_core_compile.yml.PHP(1026):
> sfRenderingFilter->execute(Object(sfFilterChain))\\n#4
> /srv/www/foo.bar/cache/frontend/prod/config/config_core_compile.yml.PHP(660):
> sfFilterChain->execute()\\n#5
> /srv/www/foo.bar/lib/vendor/symfony/1.4/lib/exception/sfError404Exception.class.PHP(49):
> sfController->forward(\'user\',404)\\n#6
> /srv/www/foo.bar/c in
> /srv/www/foo.bar/lib/vendor/symfony/1.4/lib/filter/sfBasicSecurityFilter.class.PHP
> on line 96
尽你所能,安全过滤器会拦截错误的单词选择)404操作,即使我已覆盖该操作的global security.yml。 有任何想法吗? 谢谢!     

解决方法

        问题在于操作是404,而不是404成功。尝试
404:
  is_secure: false
成功是symfony默认返回的视图。     ,        当使用默认的symfony 404时-这对我有用(错误停止显示在apache错误日志中) 创建文件夹\“ apps / frontend / modules / default / config \” 创建\“ settings.yml \” 添加以下行:
error404:
  is_secure: false
    ,        找到了解决方案: 有点奇怪,但确实有效。 在我的用户security.yml中,我必须对此进行更改:
404Success:
  is_secure: false
对此:
all:
  is_secure: false
这并不是一个真正的问题,因为我在用户模块中只具有登录名和404操作...。但是我很惊讶我不得不关闭整个模块的安全性,而不仅仅是关闭了404动作。不太确定为什么它会忽略\'404Success \'。奇怪....