提问者:小点点

Apache代理HTTPSHTTPPOST数据


我有手机应用程序上传到https://mydomain.com/files/incoming_files.php和https://mydomain.com/api/v2/incoming_files.php

Ubuntu 11.04,Apache/2.2.17

一些上传在SSL握手中超时。因此,我试图将POST上传请求代理到PHP上传脚本,从https://到超文本传输协议://并保留POST数据。

抛出这些错误:

  (70007)The timeout specified has expired: proxy: prefetch request body failed to   1.2.3.4:80
  (103)Software caused connection abort: proxy: pass request body failed to 1.2.3.4:80
   proxy: pass request body failed to 1.2.3.4:80

这是我的配置:

   <VirtualHost 1.2.3.4:443>

   RewriteEngine On
   RewriteCond %{HTTPS} on
   RewriteRule ^/?files/incoming_files\.php http://%{SERVER_NAME}/files/incoming_files\.php [NC,P]
   RewriteRule ^/?api/v2/incoming_files\.php http://%{SERVER_NAME}/api/v2/incoming_files\.php [NC,P]


   SSLProxyEngine on
   ProxyRequests Off
   ProxyPreserveHost On
   SetEnv proxy-sendchunked       1
   SetEnv proxy-sendcl            0

   ProxyPass /files/incoming_files.php http://mydomain.com/files/incoming_files.php
   ProxyPassReverse /files/incoming_files.php http://mydomain.com/files/incoming_files.php

   ProxyPass /api/v2/incoming_files.php http://mydomain.com/api/v2/incoming_files.php
   ProxyPassReverse /api/v2/incoming_files.php http://mydomain.com/api/v2/incoming_files.php

尝试过:在没有ProxyPass的情况下设置重写。设置ProxyPass而不重写。使用/不使用SetEnv proxy-sendchunked 1/proxysend-cl 0设置

知道最好的解决办法是什么吗,我做错了什么?


共1个答案

匿名用户

我在我的apache访问日志中看到了相同的错误消息:

[error] (103)Software caused connection abort: proxy: pass request body failed to X.X.X.X:Y (hostname)
[error] proxy: pass request body failed to X.X.X.X:Y (hostname) from Z.Z.Z.Z ()

唯一的区别似乎是我运行的是tcServer(Tomcat)后端。

我可以告诉你的是,我还看到了与上传请求关联的502响应代码。

"POST /<path_to_target>/upload.do?_t=1407181458532 HTTP/1.1" 502 305

我想你可能对你的ProxyPass重定向HTTPS到HTTP的事实有所了解,这是我需要测试的。

我建议您将更新代理请求值更改为On。

ProxyRequests On