Hi,

On Tue, Jan 13, Pavlos Parissis wrote:
> Hoi,
> 
> I am trying to return a specific 200 response when URL matches a ACL but I get
> back 503. Where is my mistake?
> 
> frontend mpla
>     acl robots.txt path_beg /robots.txt
> 
>     use_backend bk_robots if robots.txt
> 
>     default_backend foo_com
> 
> backend bk_robots
>     mode http
>     errorfile 200 /etc/haproxy/pages/robots.http

Does it work if you replace errorfile 200... with:
errorfile 503 /etc/haproxy/pages/robots.http ?

http://cbonte.github.io/haproxy-dconv/configuration-1.5.html#4-errorfile
("Code 200 is emitted in response to requests matching a "monitor-uri"
rule."). So this might work (untested):

frontend mpla
        errorfile 200 /etc/haproxy/pages/robots.http
        monitor-uri /robots.txt
 
-Jarno

> cat /etc/haproxy/pages/robots.http
> HTTP/1.0 200 OK
> Cache-Control: no-cache
> Connection: close
> User-Agent: *
> Disallow: /
> 
> 
> curl output
> * HTTP 1.0, assume close after body
> < HTTP/1.0 503 Service Unavailable
> < Cache-Control: no-cache
> < Connection: close
> < Content-Type: text/html
> 
> haproxy log
> mpla bk_robots/<NOSRV> 0/-1/-1/-1/0 503 212 - - SC-- 0/0/0/0/0 0/0 {} "GET
> /robots.txt HTTP/1.1" -

Reply via email to