增加特定path的清漆超时

我在/ adminpath上有一组脚本需要一段时间才能执行,并导致Varnish达到超时限制。 有没有办法增加特定path的超时而不是整个后端?

    您可能会尝试添加一个与主机相同的后端,但超时时间不同

    并用它req.backend您的url

    backend default { .host = "127.0.0.1"; .port = "81"; } backend admin { .host = "127.0.0.1"; .port = "81"; .connect_timeout = 600s; .first_byte_timeout = 600s; .between_bytes_timeout = 600s; } sub vcl_recv { ... if (req.url ~ "^/admin") { set req.backend = admin; } .. } 

    刚刚遇到这样的事情..

    我们在后端添加了以下内容(确保不要将其放在.probe {}子声明中[只是一个小错误,导致我们在短时间内产生混淆;]):

     .connect_timeout = 60s; .first_byte_timeout = 120s; .between_bytes_timeout = 60s; 

    你可以用'man vcl'来阅读更多关于他们的信息。

    希望这可以帮助!

    您可以使用pipe道进行长时间的请求

     if (req.url ~ "^/admin/long_request" || req.url ~ "^/upload") { return (pipe); } # just add the Connection: close header sub vcl_pipe { set bereq.http.connection = "close"; }