使用IE8上传较大文件时的代理错误502

时间:2013-09-17 15:34:24

标签: apache internet-explorer-8 reverse-proxy

我无法通过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&nbsp;/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反向代理服务器抛出了这个错误,基于Googling似乎表明代理和服务器之间的连接过早关闭。

[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

1 个答案:

答案 0 :(得分:0)

我在Apache服务器的代理配置文件中注释掉了这些行,问题就停止了。如果有人能解释为什么会发生这种情况,我会赞扬他们,因为我老实说不知道为什么这样才能解决问题。从谷歌搜索,我感觉有些东西过早地关闭了服务器 - 代理连接,所以nokeepalive指令可能是问题所在。我有点担心这个解决方案没有解决根本问题。

# SetEnv force-proxy-request-1.0 1
# SetEnv proxy-nokeepalive 1

更新

我在apache docs做了一些研究。看起来我们的源服务器可能无法“正确实现keepalive或HTTP / 1.1”。