Skip to content

Commit

Permalink
fix(build/patches): patch err no_valid_ip_found as 502 (#54)
Browse files Browse the repository at this point in the history
  • Loading branch information
wklken authored Oct 10, 2023
1 parent 3ff0005 commit cc90084
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 cc90084

Please sign in to comment.