-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(build/patches): patch err no_valid_ip_found as 502 (#54)
- Loading branch information
Showing
1 changed file
with
17 additions
and
0 deletions.
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
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 | ||
|