HAProxy Specific URI

504haproxytimeouturl

So my HAProxy configuration is similar to this.

listen webaustin 0.0.0.0:80
    mode http
    timeout connect 12000
    timeout server 60000
    timeout queue 120000
    balance roundrobin
    option httpchk GET /index.html
    log global
    option httplog
    option dontlog-normal
    server web1 10.10.10.101:80 maxconn 600 check fall 10
    server web2 10.10.10.102:80 maxconn 600 check fall 10
    server web3 10.10.10.103:80 maxconn 600 check fall 10
    server web4 10.10.10.104:80 maxconn 600 check fall 10

Which works pretty well for our systems, Four backend webservers, one frontend webserver, timeouts set to be reasonable.

My problem is, I have one URL, which i need to be vastly longer timeout. Its a very heavy task that takes a long time on the backend.

Is there anyway to change the timeout variables for a single URL?

Best Answer

create a single frontend to 2 backends

frontend webserver
        bind :80
        option forwardfor
        acl bk_slow url_dir /slow_uri/
        use_backend slow-pool if bk_slow
        default_backend default-pool

backend default-pool
        balance ...
        option httpchk ...
        server ...

backend slow-pool
        balance ...
        option httpchk ...
        server ...
        timeout server 600s
timeout client 600s is not necessary as it is a backend and haproxy warns about it.

I think url_dir is the best option for this, but you may want to check path_sub/reg or url_sub/reg (http://code.google.com/p/haproxy-docs/wiki/MatchingLayer7)