所以我在html/php中有一个非常简单的登录表单。
login1.php
<?php include('settings.php'); ?>
<!DOCTYPE html>
<html>
<head>
<title>login</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<body>
<form id="form1" name="form1" method="post" action="<?=$basehttp;?>/login_auth1.php">
<input name="ahd_username" type="text" id="ahd_username" size="35" maxlength="255" />
<input name="ahd_password" type="password" id="ahd_password" size="35" maxlength="35" />
<input type="submit" name="Submit" value="Login" />
</form>
</body>
</html>login_auth1.php
<?php
include('settings.php');
print_r($_POST);
print_r(getallheaders());
if(isset($_POST['ahd_username']) && isset($_POST['ahd_password'])){
//database queries and stuff, send user elsewhere if login correct
}
?>
<!DOCTYPE html>
<html>
<head>
<title>login</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<body>
<form id="form1" name="form1" method="post" action="<?=$basehttp;?>/login_auth1.php">
<input name="ahd_username" type="text" id="ahd_username" size="35" maxlength="255" />
<input name="ahd_password" type="password" id="ahd_password" size="35" maxlength="35" />
<input type="submit" name="Submit" value="Login" />
</form>
</body>
</html>当运行login1.php (在某些web浏览器中)时,login_auth1.php中的POST将为空。但是,当再次从login_auth1.php中删除完全相同的表单时,它工作得很好。造成此错误的原因可能是什么?如何进一步调试?服务器正在运行清漆。
在这个文本文件中可以找到指向某些调用的头部输出的链接。
编辑:现在已经没有头发了,但我想出了一种“有效”的方法。如果我将我的日志文件合并到一个文件中,将该文件放入一个单独的文件夹/login中,完整地删除操作标记中的url (因此它将是action=""),并将其配置为
if (req.url ~ "/login"){
set req.backend = mybackend;
return (pass);
}看起来不错。这感觉像一个非常糟糕的“解决方案”,尤其是删除动作标记中的字符串的部分,但这是我让它工作的唯一方法。我尝试了很多不同的清漆配置,包括返回(管道)。有人知道如何使它正常工作吗?或者为什么上面这个奇怪的版本起作用了?
发布于 2013-09-14 19:51:58
一个好的和持久的做法,以取代您的快速黑客,是不缓存任何帖子请求通过以下方式:
if ( req.request == "POST" ) {
return (hit_for_pass);
}发布于 2013-09-15 11:30:21
1的标准行为是将POST请求直接传递到后端:
sub vcl_recv {
#...
if (req.request != "GET" && req.request != "HEAD") {
/* We only deal with GET and HEAD by default */
return (pass);
}
#...
}因此,如果没有达到默认代码(在您的vcl_recv中调用return(xxx) ),您应该在您自己的VCL代码中处理这类请求,返回一个pass,或者按照Clarence的建议返回一个hit_for_pass。
https://stackoverflow.com/questions/18061056
复制相似问题