Hi Matt, On 2010-04-07 14:34, Matt wrote: > If I wanted to change the error return code submitted by haproxy (not > the backend server) is this possible? i.e. change haproxy to return a > 502 when it's going to return a 504?
You could (ab)use the errorfile parameter and have haproxy send arbitrary data. Thus you could do something like this: errorfile 500 /etc/haproxy/errorfiles/503.http errorfile 502 /etc/haproxy/errorfiles/503.http errorfile 503 /etc/haproxy/errorfiles/503.http errorfile 504 /etc/haproxy/errorfiles/503.http and then have the file at /etc/haproxy/errorfiles/503.http contain something like this: HTTP/1.0 503 Service Unavailable Cache-Control: no-cache Connection: close Content-Type: text/html Content-Length: 329 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Something is wrong</title> </head> <body><h1>Something went wrong</h1></body> </html> Note that you should correctly re-calculate the Content-Length header (or leave it out) if you do any changes here. --Holger