HAProxy 特定 URI

gru*_*ech 4 url timeout haproxy 504

所以我的HAProxy配置和这个类似。

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
Run Code Online (Sandbox Code Playgroud)

这对我们的系统非常有效,四个后端网络服务器,一个前端网络服务器,超时设置合理。

我的问题是,我有一个 URL,我需要更长的超时时间。这是一项非常繁重的任务,在后端需要很长时间。

无论如何要更改单个 URL 的超时变量?

小智 5

创建一个前端到 2 个后端

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 client 600s
        timeout server 600s
Run Code Online (Sandbox Code Playgroud)

我认为 url_dir 是最好的选择,但您可能需要检查 path_sub/reg 或 url_sub/reg ( http://code.google.com/p/haproxy-docs/wiki/MatchingLayer7 )