【发布时间】:2011-05-23 07:55:32
【问题描述】:
我的 symfony 项目部署在 子域上的共享主机上。
所有不安全的模块都可以正常工作,但没有安全模块加载,并且路由失败并抛出 Empty module and/or action... 错误。对于未经身份验证的模块,路由工作正常。 我在日志中找不到太多信息,只是没有调用 sfBasicSecurityFilter。
为了解决它,
- 我遵循了ticket 中的解决方案,并将“POST”添加到 sfRequestRoute 类中
- 我也试过了 将 sf_method 要求添加到路由中
- Auth 模块之前被称为默认模块,所以为了避免名称冲突,我什至更改了模块名称
- 我已经多次重置缓存
- 它适用于所有本地环境。
有什么解决办法吗?
[编辑]另一个实验 我在设置中使用了 frontend_dev.php 控制器,并与 index.php 中的日志进行了比较
index.php 请求来自不安全模块的路由/定价时
May 23 12:37:38 symfony [info] {sfPatternRouting} Connect sfRoute "sf_guard_signin" (/guard/login)
May 23 12:37:38 symfony [info] {sfPatternRouting} Connect sfRoute "sf_guard_signout" (/guard/logout)
May 23 12:37:38 symfony [info] {sfPatternRouting} Connect sfRoute "sf_guard_forgot_password" (/guard/forgot_password)
May 23 12:37:38 symfony [info] {sfPatternRouting} Connect sfDoctrineRoute "sf_guard_forgot_password_change" (/guard/forgot_password/:unique_key)
May 23 12:37:38 symfony [info] {sfPatternRouting} Match route "home_pricing" (/pricing) for /pricing with parameters array ( 'module' => 'home', 'action' => 'pricing',)
May 23 12:37:38 symfony [info] {sfFilterChain} Executing filter "sfRenderingFilter"
May 23 12:37:38 symfony [info] {sfFilterChain} Executing filter "sfCacheFilter"
May 23 12:37:38 symfony [info] {sfFilterChain} Executing filter "sfCommonFilter"
May 23 12:37:38 symfony [info] {sfFilterChain} Executing filter "sfExecutionFilter"
May 23 12:37:38 symfony [info] {homeActions} Call "homeActions->executePricing()"
....
May 23 12:37:38 symfony [info] {sfWebResponse} Send status "HTTP/1.1 200 OK"
May 23 12:37:38 symfony [info] {sfWebResponse} Send header "Content-Type: text/html; charset=utf-8"
May 23 12:37:38 symfony [info] {sfWebResponse} Send content (6444 o)
frontend_dev.php 请求来自不安全模块的路由/定价时
May 24 08:14:28 symfony [info] {sfPatternRouting} Connect sfRoute "sf_guard_signin" (/guard/login)
May 24 08:14:28 symfony [info] {sfPatternRouting} Connect sfRoute "sf_guard_signout" (/guard/logout)
May 24 08:14:28 symfony [info] {sfPatternRouting} Connect sfRoute "sf_guard_forgot_password" (/guard/forgot_password)
May 24 08:14:28 symfony [info] {sfPatternRouting} Connect sfDoctrineRoute "sf_guard_forgot_password_change" (/guard/forgot_password/:unique_key)
May 24 08:14:28 symfony [err] {sfError404Exception} Empty module and/or action after parsing the URL "/frontend_dev.php/pricing" (/).
May 24 08:14:28 symfony [info] {sfWebResponse} Send status "HTTP/1.0 404 Not Found"
我正在使用 HTACCESS 启用路由 /public_html/.htaccess(空)
/public_html/demo/.htaccess
#RewriteEngine on
#RewriteBase /
#RewriteCond %{REQUEST_URI} !^/web/
#RewriteRule .* /web/%1 [QSA]
Options +FollowSymLinks +ExecCGI
<IfModule mod_rewrite.c>
RewriteEngine On
# we skip all files in /web
RewriteCond %{REQUEST_URI} ^/web/
RewriteRule .* - [L]
# we rewrite all other files with .something to /web
RewriteCond %{REQUEST_URI} \..+$
RewriteCond %{REQUEST_URI} !\.html$
RewriteRule ^(.*)$ /web/$1 [L]
# !!! UNTESTED !!! ##################################
# we check if the .html version is in /web (caching)
#RewriteRule ^$ /web/index.html [QSA]
#RewriteRule ^([^.]+)$ /web/$1.html [QSA]
#####################################################
# no, so we redirect to our front web controller
RewriteRule ^(.*)$ /web/index.php [QSA,L]
</IfModule>
# big crash from our front web controller
ErrorDocument 500 "<h2>Application error</h2>symfony application failed to start properly"
/public_html/demo/web/.htaccess(空)
【问题讨论】:
标签: authentication symfony1 routing hosting