Timeout for subrequest

79 views
Skip to first unread message

hende...@gmail.com

unread,
Jul 3, 2015, 4:38:41 PM7/3/15
to openre...@googlegroups.com
Hi,
Is it possible to set the timeout separately for each subrequest in capture_multi?
Something like:
local res_main, res_guard = ngx.location.capture_multi {
          {
            "/main" .. ngx.var.uri, { copy_all_vars = true, always_forward_body = true, timeout = 30000 } -- (in milliseconds)
          },
          {
              "/static/lore_ipsum.txt", { timeout = 60000 }
          }
      }

Or i should use "proxy_read_timeout" for every location/upstream ?

BR
Hendersson

Yichun Zhang (agentzh)

unread,
Jul 4, 2015, 12:09:39 AM7/4/15
to openresty-en
Hello!

On Sat, Jul 4, 2015 at 4:38 AM, <hende...@gmail.com> wrote:
> Hi,
> Is it possible to set the timeout separately for each subrequest in
> capture_multi?

No, the subrequest mechanism does not provide timeout protection
itself. Rather, your location targeted by the subrequests control the
timeout protection. See

https://openresty.org/faq.html#can-i-set-timeout-threshold-on-subrequests

>
> Or i should use "proxy_read_timeout" for every location/upstream ?
>

Alas, these proxy_xxx_timeout directives do not support nginx
variables. Otherwise you can pass such settings via different variable
bindings (via the `vars` option). CloudFlare's private fork of nginx
does allow this. Maybe we could backport it to OpenResty's bundled
version of the nginx core :)

Regards,
-agentzh
Reply all
Reply to author
Forward
0 new messages