22

I get this error every few minutes when using mod_proxy as a reverse proxy to a SOAP web service. There's probably 3 or 4 requests going per seconds so we're talking around 1 or 2 out of every thousand that have this error.

[Tue Nov 23 11:44:14 2010] [error] [client 172.16.1.31] (20014)Internal error: proxy: error reading status line from remote server soap1.server:8888
[Tue Nov 23 11:44:14 2010] [error] [client 172.16.1.31] proxy: Error reading from remote server returned by /someapp/path/to/web/service

This causes the request to fail. If I have the client connect directly to the soap server without using the proxy, success is 100% so the problem appears to be in the proxy

The configuration looks like this. The purpose is to switch to a backup server if the primary one is unavailable:

<Proxy balancer://apicluster>  
BalancerMember http://soap1.server:8888 lbset=0 
BalancerMember http://soap2.server:8888 lbset=1 
</Proxy>  

ProxyPass /someapp balancer://apicluster/someapp 
ProxyPassReverse / balancer://apicluster/someapp 

Has anyone run into this and found a fix? There's some mentions in bug reports but no solutions. The only thing that may be unusual is the client request could be 100MB or larger, so the request could take a little longer than you'd expect for a SOAP call.

1
  • The answer by David Purdue (SetEnv proxy-initial-not-pooled 1) is a valid answer nowadays (2016).
    – MattBianco
    Sep 26, 2016 at 14:43

3 Answers 3

28

In case someone else runs into this. This is a bug in mod_proxy that can be avoided by putting these lines in your httpd.conf:

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

https://issues.apache.org/bugzilla/show_bug.cgi?id=37770

For info on what these variables do see the mod_proxy documentation. They have a specific section, Protocol Adjustment, that addresses these variables.

1
  • Depending on your installation, the httpd.conf file might be in the following locations (source): - /etc/apache2/httpd.conf - /etc/apache2/apache2.conf - /etc/httpd/httpd.conf - /etc/httpd/conf/httpd.conf
    – chris
    Jun 18, 2020 at 16:03
5

Take note of the Apache documentation here: http://httpd.apache.org/docs/2.2/mod/mod_proxy_http.html

It seems there is a race condition in mod_proxy_http, but it can be avoided by including:

SetEnv proxy-initial-not-pooled 1

Which prevents Apache using a pooled connection if this is an initial request.

The document does note that this setting will give a performance downgrade.

1
0

You can also suppress this related error message (AH01102: error reading status line from remote server) by using the apache module mod_reqtimeout and this conf directive:

RequestReadTimeout header=30

You'll likely have to enable the reqtimeout module, as follows:

$ sudo a2enmod reqtimeout
$ sudo apache2ctl restart

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .