我无法通过 Apache 反向代理将使用 IE8 的文件上传到远程 Web 服务器。我使用 Fiddler 来跟踪请求和响应。提交带有大约大于 17KB 的 .txt 的表单,我收到以下错误:代理错误 502。通过相同的表单提交同一文件的较小版本有效。 是什么原因造成的,为什么其他浏览器不会发生这种情况?
更新——我使用 fiddler 删除了Cache-Control: no-cache
我注意到 Firefox 没有使用的行并且它有效。不知道我将如何解决它,所以问题仍然存在。
失败响应
HTTP/1.1 502 Proxy Error
Date: Tue, 17 Sep 2013 14:16:56 GMT
Server: Apache/2.4.3 (Unix) OpenSSL/1.0.1c
Content-Length: 468
Keep-Alive: timeout=30, max=96
Connection: Keep-Alive
Content-Type: text/html; charset=iso-8859-1
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>502 Proxy Error</title>
</head><body>
<h1>Proxy Error</h1>
<p>The proxy server received an invalid
response from an upstream server.<br />
The proxy server could not handle the request <em><a href="/this/is/not/the/real/url.ajax">POST /this/is/not/the/real/url.ajax</a></em>.<p>
Reason: <strong>Error reading from remote server</strong></p></p>
</body></html>
失败的请求标头
POST https://www.foo.com/blah.ajax HTTP/1.1
Accept: image/gif, image/jpeg, image/pjpeg, image/pjpeg, application/x-shockwave-flash, */*
Referer: https://www.mysite.com/blah.html
Accept-Language: en-us
User-Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0)
Content-Type: multipart/form-data; boundary=---------------------------7dd2702f50124
Accept-Encoding: gzip, deflate
Host: www.mysite.com
Content-Length: 412501
Connection: Keep-Alive
Cache-Control: no-cache
(cookies and data removed for brevity...)
成功响应
HTTP/1.1 200 OK
Date: Tue, 17 Sep 2013 15:10:34 GMT
Server: myServer
Accept-Ranges: bytes
Cache-Control: no-cache
Content-Length: 59
Content-Type: text/html; charset=utf-8
Expires: Tue, 17 Sep 2013 16:10:34 GMT
Pragma: no-cache
Keep-Alive: timeout=30, max=100
Connection: Keep-Alive
{
"received":"what I expected"
}
成功的请求标头
POST https://www.foo.com/blah.ajax HTTP/1.1
Accept: image/gif, image/jpeg, image/pjpeg, image/pjpeg, application/x-shockwave-flash, */*
Referer: https://www.mysite.com/blah.html
Accept-Language: en-us
User-Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0)
Content-Type: multipart/form-data; boundary=---------------------------7dd983550124
Accept-Encoding: gzip, deflate
Host: www.mysite.com
Content-Length: 1287
Connection: Keep-Alive
Cache-Control: no-cache
(cookies and data removed for brevity...)
更新 2 开始变得更加清晰。我的 Apache 反向代理服务器抛出了这个错误,基于谷歌搜索似乎表明代理和服务器之间的连接过早关闭。
[Mon Sep 16 17:06:24.983899 2013] [proxy:error] [pid 14796:tid 140093427799808]
[client myipaddress:port] AH00898: Error reading from remote server returned by
/the/requested/page, referer:
https://www.mySite.com