Apache 上传文件时mod_proxy 502代理错误

Apache 上传文件时mod_proxy 502代理错误,apache,file-upload,proxy,lighttpd,mod-proxy,Apache,File Upload,Proxy,Lighttpd,Mod Proxy,我正在尝试配置以下环境:一个运行apache和mod_代理的VPS来代理另一个在家中运行的服务器(后端)。我可以下载文件,但当我尝试上载文件时,POST请求失败,出现以下错误: Proxy Error The proxy server received an invalid response from an upstream server. The proxy server could not handle the request POST /upload/upload.php. Reaso

我正在尝试配置以下环境:一个运行apache和mod_代理的VPS来代理另一个在家中运行的服务器(后端)。我可以下载文件,但当我尝试上载文件时,POST请求失败,出现以下错误:

Proxy Error

The proxy server received an invalid response from an upstream server.
The proxy server could not handle the request POST /upload/upload.php.

Reason: Error reading from remote server
我不明白的是为什么它适用于低至500字节的文件。而且速度很快!然而,当我试图上传一个小的4kb文件时,需要花费很长时间才能达到错误。正如预期的那样,在没有VPS的情况下,直接访问后端时,上传可以完美地工作。我尝试了双方的许多配置,也尝试了增加超时时间,但我认为这不是解决问题的方法。后端已安装mod_access,当文件上载失败时,它不会记录任何内容

apache会记录以下内容:

[Thu Nov 07 22:26:03.044309 2013] [proxy_http:error] [pid 9173] (70007)The timeout specified has expired: [client 177.148.252.99:54097] AH01102: error reading status line from remote server myhome.com, referer: http://frontend.com/upload/
[Thu Nov 07 22:26:03.044423 2013] [proxy:error] [pid 9173] [client 177.148.252.99:54097] AH00898: Error reading from remote server returned by /upload/upload.php, referer: http://frontend.com/upload/
VPS运行的是Apache2.4.6,在家中运行的服务器是带有SSL的LightTPD1.4.32

重定向到后端的虚拟主机配置如下:

<VirtualHost *:80>
        ServerAdmin webmaster@frontend.com
        ServerName frontend.com
        ProxyPass        / http://backend.com/
        ProxyPassReverse / http://backend.com/
</VirtualHost>

服务器管理员webmaster@frontend.com
ServerName frontend.com
ProxyPass/http://backend.com/
ProxyPassReverse/http://backend.com/
前端:

后端:


你有什么想法吗?

我曾经遇到过类似的问题,并且通过声明得到了解决,我把它放在
ProxyPassReverse
声明之后


您必须使用的命令是:
SetEnv proxy sendchunks 1

您看到的错误是由于到后端系统的代理连接超时。您需要将ProxyTimeout值设置为大于默认值的值。我建议您从60秒开始,看看它是如何工作的

ProxyTimeout 60
此外,我同意Varghese的观点,即您需要设置环境变量,以便将连接配置为以块的形式发送数据。不幸的是,对于是否应该使用正确的设置存在一些混淆,因此您可以尝试以下任一设置:

SetEnv proxy-sendchunked  1

祝你好运。这是一个令人沮丧的问题


mod\u proxy
中提供的环境变量:

SetEnv proxy-sendchunks  1