【发布时间】:2015-04-23 18:47:50
【问题描述】:
我正在使用一个自制的小型 CGI 路由器来创建一个简单的 webapp,代码可以在这里找到github
webapp 有一个像这样的登录表单
my $form = start_form( -method => 'post', -action => '/login' );
$form .= p( label('Mail'), textfield( -name => 'mail' ) );
$form .= p( label('Mail'), password_field( -name => 'pass' ) );
$form .= p( submit( -value => 'Log ind', -class => 'button button-primary' ) );
$form .= end_form();
我有一个路由器处理这样的发布请求
$router->add_route( 'POST', '/login', sub {
if ( param ) {
# Get mail and pass
my $mail = $cgi->param( 'mail' );
my $pass = $cgi->param( 'password' );
# Check against user table
# Set cookie and redirect to admin
}
# Otherwise redirect to /login
print redirect( -url => '/login' );
});
在我的本地环境中,osx 10.10.3,perl 5,版本 18,subversion 2 (v5.18.2),这按预期工作,我提交表单并处理登录,没问题。
根据 ENV{'SERVER_SOFTWARE'},我的生产环境是 Microsoft-IIS/5.0
在生产环境中返回 404,不幸的是,我无法获得任何可能揭示有用信息的日志文件。
生产环境和本地环境中的.htaccess 文件
# RewriteBase /
DirectoryIndex index.pl index.phtml index.html
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !=/favicon.ico
RewriteRule ^(.*)$ index.pl [L,QSA]
【问题讨论】: