-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(patch): control the proxy_upstream in lua side (#14029)
Sister PR: Kong/lua-kong-nginx-module#98 AG-186
- Loading branch information
Showing
3 changed files
with
34 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
build/openresty/patches/nginx-1.25.3_10-proxy-upstream-next.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
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..7f7132d 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)) | ||
{ | ||
@@ -4420,7 +4424,12 @@ ngx_http_upstream_next(ngx_http_request_t *r, ngx_http_upstream_t *u, | ||
} | ||
|
||
if (u->peer.tries == 0 | ||
+#if (NGX_HTTP_LUA_KONG) | ||
+ || ((ngx_http_lua_kong_get_next_upstream_mask(r, u->conf->next_upstream) & ft_type) != ft_type) | ||
+#else | ||
|| ((u->conf->next_upstream & ft_type) != ft_type) | ||
+#endif | ||
+ | ||
|| (u->request_sent && r->request_body_no_buffering) | ||
|| (timeout && ngx_current_msec - u->peer.start_time >= timeout)) | ||
{ |
4 changes: 4 additions & 0 deletions
4
changelog/unreleased/kong/feat-patch-supprt-set_next_upstream.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
message: | | ||
Add a patch for kong.resty.set_next_upstream() to control the next upstream retry logic in lua side. [Kong/lua-kong-nginx-module#98](https://github.com/Kong/lua-kong-nginx-module/pull/98) | ||
type: bugfix | ||
scope: Core |
c77a178
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bazel Build
Docker image available
kong/kong:c77a1786f2792bb1255b411281a7a9b6473fe469
Artifacts available https://github.com/Kong/kong/actions/runs/12469279776