Skip to content

Commit

Permalink
Merge pull request #55 from TencentBlueKing/master
Browse files Browse the repository at this point in the history
backport: fix no valid ip found 502
  • Loading branch information
wklken authored Oct 10, 2023
2 parents 3b3ee3e + cc90084 commit 24ef5da
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/build/patches/003_patch_no_valid_ip_found_502.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
diff --git a/apisix/init.lua b/apisix/init.lua
index 388af426..9899c332 100644
--- a/apisix/init.lua
+++ b/apisix/init.lua
@@ -431,6 +431,12 @@ function _M.handle_upstream(api_ctx, route, enable_websocket)
route, err = parse_domain_in_route(route)
if err then
core.log.error("failed to get resolved route: ", err)
+
+ -- if the dns resolve get no valid ips, return 502 , treat it as `pick_server` fail
+ if err == "no valid ip found" then
+ return core.response.exit(502)
+ end
+
return core.response.exit(500)
end

0 comments on commit 24ef5da

Please sign in to comment.