Skip to content

Commit

Permalink
feat(patch): control the proxy_upstream in lua side
Browse files Browse the repository at this point in the history
  • Loading branch information
oowl committed Dec 17, 2024
1 parent d40cedd commit 894bcc6
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .requirements
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ LIBEXPAT_SHA256=d4cf38d26e21a56654ffe4acd9cd5481164619626802328506a2869afab29ab3

# Note: git repositories can be loaded from local path if path is set as value

LUA_KONG_NGINX_MODULE=3eb89666f84348fa0599d4e0a29ccf89511e8b75 # 0.13.0
LUA_KONG_NGINX_MODULE=0b9cf13a779e2d8703f6770f7228984779dbf948 # 0.13.0
LUA_RESTY_LMDB=9da0e9f3313960d06e2d8e718b7ac494faa500f1 # 1.6.0
LUA_RESTY_EVENTS=bc85295b7c23eda2dbf2b4acec35c93f77b26787 # 0.3.1
LUA_RESTY_SIMDJSON=7e6466ce91b2bc763b45701a4f055e94b1e8143b # 1.1.0
Expand Down
16 changes: 16 additions & 0 deletions build/openresty/patches/nginx-1.25.3_10-proxy-upstream-next.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
diff --git a/bundle/nginx-1.25.3/src/http/ngx_http_upstream.c b/bundle/nginx-1.25.3/src/http/ngx_http_upstream.c
index 2be233c..6edff37 100644
--- a/bundle/nginx-1.25.3/src/http/ngx_http_upstream.c
+++ b/bundle/nginx-1.25.3/src/http/ngx_http_upstream.c
@@ -2563,7 +2563,11 @@ ngx_http_upstream_test_next(ngx_http_request_t *r, ngx_http_upstream_t *u)
}

if (u->peer.tries > 1
+#if (NGX_HTTP_LUA_KONG)
+ && ((ngx_http_lua_kong_get_next_upstream_mask(r, u->conf->next_upstream) & mask) == mask)
+#else
&& ((u->conf->next_upstream & mask) == mask)
+#endif
&& !(u->request_sent && r->request_body_no_buffering)
&& !(timeout && ngx_current_msec - u->peer.start_time >= timeout))
{

0 comments on commit 894bcc6

Please sign in to comment.