Apisix自定义httpcode 重试
Apisix 自定义httpcode请求重试
我们通过插件来做比较麻烦并且还需要考虑重新lb的问题,有一个比较简单的方法是利用nginx的请求重试信号。
Apisix本身默认也有该种设定,不过默认只针对 timeout情况会请求重试
默认请求重试次数是:updateam node 节点数量 -1
相关逻辑在 https://github.com/apache/apisix/blob/master/apisix/balancer.lua#L142C16-L142C33 的 `set_balancer_opts` 方法中
设置请求重试:
https://github.com/apache/apisix/blob/master/apisix/cli/ngx_tpl.lua#L760
我们可以在760行左右添加
`proxy_next_upstream error timeout http_500 http_429 non_idempotent;`
支持的httpcode 和 含义 可以看nginx官方文档
https://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_next_upstream
我们通过插件来做比较麻烦并且还需要考虑重新lb的问题,有一个比较简单的方法是利用nginx的请求重试信号。
Apisix本身默认也有该种设定,不过默认只针对 timeout情况会请求重试
默认请求重试次数是:updateam node 节点数量 -1
相关逻辑在 https://github.com/apache/apisix/blob/master/apisix/balancer.lua#L142C16-L142C33 的 `set_balancer_opts` 方法中
设置请求重试:
https://github.com/apache/apisix/blob/master/apisix/cli/ngx_tpl.lua#L760
我们可以在760行左右添加
`proxy_next_upstream error timeout http_500 http_429 non_idempotent;`
支持的httpcode 和 含义 可以看nginx官方文档
https://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_next_upstream
全部评论
相关推荐
08-06 16:46
门头沟学院 Java 鲁大牛:真是个纸张公司。我综测瞎写的还是进笔试了,笔试大部分都空着还是进面试了。一面一口气问了我15道八股文我都答对了,算法也A出来了。结果一面挂了

点赞 评论 收藏
分享