Can I configure mod_proxy to use different parameters based on HTTP Method?

Posted by Graham Lea on Server Fault See other posts from Server Fault or by Graham Lea
Published on 2011-09-02T01:26:43Z Indexed on 2012/08/31 9:40 UTC
Read the original article Hit count: 293

I'm using mod_proxy as a failover proxy with two balance members.

While mod_proxy marks dead nodes as dead, it still routes one request per minute to each dead node and, if it's still dead, will either return 503 to the client (if maxattempts=0) or retry on another node (if it's > 0).

The backends are serving a REST web service. Currently I have set maxattempts=0 because I don't want to retry POSTs and DELETEs. This means that when one node is dead, each minute a random client will receive a 503. Unfortunately, most of our clients are interpreting codes like 503 as "everything is dead" rather than "that didnt work but please try that again".

In order to program some kind of automatic retry for safe requests at the proxy layer, I'd like to configure mod_proxy to use maxattempts=1 for GET and HEAD requests and maxattempts=0 for all other HTTP Methods.

Is this possible? (And how? :)

© Server Fault or respective owner

Related posts about apache2

Related posts about load-balancing