使mod_proxy_httpasynchronous发回响应(无100继续)

Servlet引擎(Jetty)运行在Apache Httpd服务器后面,使用mod_proxy_http转发。 这是运行一个小的servlet,它接受PUT请求,并使用HTTP基本authentication(在Jetty中处理)进行authentication。

使用curl执行直接(非代理)的PUT请求时,使用错误的身份validation凭据,服务器将按预期方式返回401状态码:

 curl -v -T testfile -u user:WRONG_PASSWORD http://localhost:8080/myservlet/ 

这样一旦收到状态码就中断请求,所以curl不会全部上传,而是提前停止( HTTP error before end of send, stop sending )。

 * About to connect() to localhost port 8080 (#0) * Trying 127.0.0.1... connected * Server auth using Basic with user 'user' > PUT /myservlet/testfile HTTP/1.1 > Authorization: Basic xxxxxxxxxxxxxxxxx > User-Agent: curl/7.22.0 > Host: localhost:8080 > Accept: */* > Content-Length: 3672 > Expect: 100-continue > < HTTP/1.1 401 Unauthorized < Date: xxxxxxxxxxxxxxxx * Authentication problem. Ignoring this. < WWW-Authenticate: basic realm="Test Realm" < Content-Length: 0 < Server: Jetty(7.4.5.v20110725) * HTTP error before end of send, stop sending < * Closing connection #0 

相比之下,在mod_proxy_http后面,有一个由Apache Httpd几乎直接发送的100 Continue响应,这个curl被解释为continue ,因此它在最终得到401响应之前发送整个请求( We are completely uploaded and fine )。

 * Trying 127.0.0.1... connected * Server auth using Basic with user 'user' > PUT /myservlet/testfile HTTP/1.1 > Authorization: Basic xxxxxxxxxxxxxxxxx > User-Agent: curl/7.22.0 > Host: localhost > Accept: */* > Content-Length: xxxxxx > Expect: 100-continue > < HTTP/1.1 100 Continue * We are completely uploaded and fine < HTTP/1.1 401 Unauthorized < Date: xxxxxxxxxxxxxxxx < Server: Jetty(7.4.5.v20110725) * Authentication problem. Ignoring this. < WWW-Authenticate: basic realm="Test Realm" < Content-Length: 0 < Via: 1.1 localhost < Content-Type: xxxxxxxxxxxxxx < * Connection #0 to host localhost left intact * Closing connection #0 

有没有办法阻止mod_proxy_http使用100 Continue代码,并使其在发送第一个响应之前等待来自后端服务器的401状态码?

我试图从这个问题中遵循以下build议 ,但是这并没有解决问题(反正这个问题并不是这个问题):

  ProxyPass /myservlet/ http://localhost:8080/myservlet/ <Location /myservlet/> RequestHeader unset Expect early </Location>