這是發生在您的腳本中的事情;這不是一個HTTP問題。重定向將導致使用相同方法(307/308)或GET
(302/303)發出的請求。重定向的GET
永遠不會變成POST
;因此,您的問題與註銷腳本中的重定向無關。
在你的情況,schedule-so.php似乎有某種時區檢測代碼。以下是發生的情況:
首先註銷。
GET http://dev.bridgebase.com/barmar_test/new_vugraph/webutil.php?op=logout HTTP/1.1
Host: dev.bridgebase.com
Connection: keep-alive
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.4 (KHTML, like Gecko) Chrome/22.0.1229.56 Safari/537.4
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Referer: http://dev.bridgebase.com/barmar_test/new_vugraph/schedule-so.php
Accept-Encoding: gzip,deflate,sdch
Accept-Language: en-US,en;q=0.8,es;q=0.6
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3
Cookie: PHPSESSID=ub7ov6vvsrrpgq0g7cdoieqne3
這將導致預期的重定向。
HTTP/1.1 302 Moved Temporarily
Server: nginx/1.2.1
Date: Fri, 14 Sep 2012 23:00:38 GMT
Content-Type: text/html
Transfer-Encoding: chunked
Connection: keep-alive
X-Powered-By: PHP/5.4.3-6
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
Location: http://dev.bridgebase.com/barmar_test/new_vugraph/schedule-so.php#
0
瀏覽器GET
s sechedule-so.php。
GET http://dev.bridgebase.com/barmar_test/new_vugraph/schedule-so.php HTTP/1.1
Host: dev.bridgebase.com
Connection: keep-alive
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.4 (KHTML, like Gecko) Chrome/22.0.1229.56 Safari/537.4
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Referer: http://dev.bridgebase.com/barmar_test/new_vugraph/schedule-so.php
Accept-Encoding: gzip,deflate,sdch
Accept-Language: en-US,en;q=0.8,es;q=0.6
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3
Cookie: PHPSESSID=ub7ov6vvsrrpgq0g7cdoieqne3
然後schedule-so.php用自動提交的表單做出響應。
HTTP/1.1 200 OK
Server: nginx/1.2.1
Date: Fri, 14 Sep 2012 23:00:38 GMT
Content-Type: text/html
Connection: keep-alive
Vary: Accept-Encoding
X-Powered-By: PHP/5.4.3-6
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Pragma: no-cache
Cache-control: private
Content-Length: 989
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<script type="text/javascript">
function get_tz()
{
var now = new Date()
document.tz_form.offset.value = now.getTimezoneOffset()
document.tz_form.submit()
}
</script>
<object><noscript>
<p> Javascript support is needed for this page (to get your local timezone).<br />
Your browser either has no Javascript support,
or has such support disabled.<br />
As an alternative, click <a href="http://dev.bridgebase.com/barmar_test/new_vugraph/schedule-so.php?offset=0">here</a> to continue.<br />
All times will be GMT.</p> </noscript></object>
</head>
<body onload='get_tz()'>
<form name="tz_form" action="/barmar_test/new_vugraph/schedule-so.php" method="post">
<input type='hidden' name='offset' />
</form>
</body>
</html>
...和onload
,JavaScript的導致表單提交,這哪裏是POST
從何而來。
POST http://dev.bridgebase.com/barmar_test/new_vugraph/schedule-so.php HTTP/1.1
Host: dev.bridgebase.com
Connection: keep-alive
Content-Length: 10
Cache-Control: max-age=0
Origin: http://dev.bridgebase.com
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.4 (KHTML, like Gecko) Chrome/22.0.1229.56 Safari/537.4
Content-Type: application/x-www-form-urlencoded
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Referer: http://dev.bridgebase.com/barmar_test/new_vugraph/schedule-so.php
Accept-Encoding: gzip,deflate,sdch
Accept-Language: en-US,en;q=0.8,es;q=0.6
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3
Cookie: PHPSESSID=ub7ov6vvsrrpgq0g7cdoieqne3
offset=240
最後登陸日程安排頁面。
HTTP/1.1 200 OK
Server: nginx/1.2.1
Date: Fri, 14 Sep 2012 23:00:38 GMT
Content-Type: text/html
Connection: keep-alive
Vary: Accept-Encoding
X-Powered-By: PHP/5.4.3-6
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Pragma: no-cache
Cache-control: private
Content-Length: 35892
...
所以你需要尋找get_tz()
在時間表so.php,並找出爲什麼被髮送到瀏覽器。我的猜測是用戶的時區存儲在會話中(在註銷期間會被燒燬)。
要更好地瞭解您的HTTP請求中發生了什麼,請使用Fiddler。
什麼樣的重定向? '301','302','303' ...? –
我只是在PHP腳本中執行'header(「Location:$ referer」)',這導致了302. – Barmar
這可能是PHP文件中的一些空白混淆了請求...? – jtheman