ngx.location.capture 设置超时

150 views
Skip to first unread message

tinyhui wang

unread,
Jul 14, 2019, 10:18:49 PM7/14/19
to openresty
HI,春哥:


         我们在用openresty 做api网关,使用ngx.location.capture 来发起后端服务调用,ngx.location.capture可以设置超时时间吗?



感谢。

tinyhui wang

unread,
Jul 14, 2019, 10:31:20 PM7/14/19
to openresty
我了解到

proxy_connect_timeout


proxy_read_timeout


proxy_send_timeout


这三个参数可以配置超时时间,但是这个一个全局的,即所有请求都会应用该配置,我想要的是针对ngx.location.capture来做超时配置,这样就可以细粒度到具体的后端的某个服务。


在 2019年7月15日星期一 UTC+8上午10:18:49,tinyhui wang写道:

DeJiang Zhu

unread,
Jul 19, 2019, 12:24:40 PM7/19/19
to open...@googlegroups.com
ngx.location.capture 本身是没有超时时间的,因为就是一个子请求调用(实际上就是 c function call),并没有走网络

你应该在 ngx.location.capture 所调用的接口里来设置超时时间

tinyhui wang <tinyhu...@gmail.com> 于2019年7月15日周一 上午10:31写道:
--
--
邮件来自列表“openresty”,专用于技术讨论!
订阅: 请发空白邮件到 openresty...@googlegroups.com
发言: 请发邮件到 open...@googlegroups.com
退订: 请发邮件至 openresty+...@googlegroups.com
归档: http://groups.google.com/group/openresty
官网: http://openresty.org/
仓库: https://github.com/agentzh/ngx_openresty
教程: http://openresty.org/download/agentzh-nginx-tutorials-zhcn.html
---
您收到此邮件是因为您订阅了Google网上论坛上的“openresty”群组。
要退订此群组并停止接收此群组的电子邮件,请发送电子邮件到openresty+...@googlegroups.com
要在网络上查看此讨论,请访问https://groups.google.com/d/msgid/openresty/91f7e026-08d3-4744-80a3-dbe380a9e0fd%40googlegroups.com

tinyhui wang

unread,
May 6, 2020, 1:17:08 AM5/6/20
to open...@googlegroups.com
谢谢,目前是通过设置多个location 进行可选的超时配置,已经通过lua_resty_http模块进行高级的自定义超时时间设置。

DeJiang Zhu <douji...@gmail.com> 于2019年7月20日周六 上午12:24写道:
Reply all
Reply to author
Forward
0 new messages