-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Description
Description
Access an upstream discovered through Eureka service via version 3.12 of apisix, where the Eureka registered address is a domain name: dev-test.com, not an IP address. Access via http:dev-test.com/HJService/info works alone. However, when accessed via apisix, the following error occurs:
2025/05/20 11:10:39 [error] 1470660#1470660: *359 [lua] balancer.lua:388: run(): failed to set server peer [dev-test.com:80] err: no host allowed while connecting to upstream, client: 10.10.120.117, server: _, request: "GET /HJService/info HTTP/1.1", host: "172.30.94.83:9080"dns resolve worked good:
nslookup dev-test.com 10.255.255.88
Server: 10.255.255.88
Address: 10.255.255.88#53
Non-authoritative answer:
Name: dev-test.com
Address: 172.30.9.198I tried modifying eureka/init.lua, adding logic for domain name resolution to IP addresses. The process worked, but I found another issue: the forwarded request cannot carry the original domain name of the service discovery target node.
How to resolve this problem?
中文描述
通过apisix 3.12版本访问通过Eureka服务发现的上游节点,其中Eureka注册的地址为域名(dev-test.com,而非IP地址)。单独通过http://dev-test.com/HJService/info访问是正常的,但通过apisix访问时出现以下错误:
2025/05/20 11:10:39 [error] 1470660#1470660: *359 [lua] balancer.lua:388: run(): failed to set server peer [dev-test.com:80] err: no host allowed while connecting to upstream, client: 10.10.120.117, server: _, request: "GET /HJService/info HTTP/1.1", host: "172.30.94.83:9080"DNS解析正常:
nslookup dev-test.com 10.255.255.88
Server: 10.255.255.88
Address: 10.255.255.88#53
Non-authoritative answer:
Name: dev-test.com
Address: 172.30.9.198 我尝试修改eureka/init.lua,增加域名解析为IP的逻辑,流程可以走通,但发现另一个问题:转发的请求无法携带服务发现目标节点的原始域名。
如何解决这个问题?
Environment/环境
- APISIX version (run
apisix version): 3.12 - Operating system (run
uname -a): Linux 172.30.94.83 5.10.0-60.18.0.50.oe2203.x86_64 change: added doc of how to load plugin. #1 SMP Wed Mar 30 03:12:24 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux - OpenResty / Nginx version (run
openresty -Vornginx -V): openresty/1.27.1.1 - etcd version, if relevant (run
curl http://127.0.0.1:9090/v1/server_info): etcd_version":"3.4.0 - APISIX Dashboard version, if relevant:
- Plugin runner version, for issues related to plugin runners:
- LuaRocks version, for installation issues (run
luarocks --version):
Metadata
Metadata
Assignees
Labels
Type
Projects
Status