edda25 opened a new issue, #12079:
URL: https://github.com/apache/apisix/issues/12079
### Description
Hi.
I’m new to Apache Apisix and looking into the documentation, but still I
cannot solve the following issue I’m encountering when I configure upstreams
with multiple nodes. Specifically, when I use the default “pass_host = pass” to
route traffic to the nodes of an upstream, HTTP requests get responses with 4XX
or 5XX status code. My configuration is as minimal as:
{
"nodes": [
{
"host": "webservice1",
"port": xxx,
"weight": 1
},
{
"host": "webservice2",
"port": xxx,
"weight": 1
}
],
"timeout": {
"connect": 6,
"send": 6,
"read": 30
},
"type": "roundrobin",
"scheme": "https",
"pass_host": "pass",
"keepalive_pool": {
"idle_timeout": 60,
"requests": 1000,
"size": 320
}
}
These webservices reside on two different external servers and respond with
a 200 status code if directly queried.
I have the same issue when the upstream has a single node, but in that case
I simply set “pass_host = node” and everything works fine. Unfortunately, I
cannot use “node” in the case of multiple nodes (the dashboard doesn’t permit
me), even though I found examples on the official documentation where it seems
possible. I know that with “pass_host=pass” Apisix passes transparently the
request’s hosts to the upstream, but I am not sure I completely understand what
this means. To bypass this, I tried to configure the proxy-rewrite plugin on
the corresponding route, but I can set only one single host and my upstream
have at least two nodes with different hosts. What am I missing?
It seems to me that hosts' headers are not handled properly, are they?
Here is what access.log shows:
- with a single node (host: webservice1) and pass_host = pass
xxx.xxx.xxx.xxx - - [17/Mar/2025:16:11:29 +0100] api-gw "GET / HTTP/1.1" 503
2515 0.063 "-" "curl/8.12.1" yyy.yyy.yyy.yyy 503 0.060
["https://api-gw/"](https://api-gw/)
- with a single node (host: webservice1) and pass_host = node or configuring
proxy-rewrite on the route
xxx.xxx.xxx.xxx - - [17/Mar/2025:16:12:34 +0100] api-gw "GET / HTTP/1.1" 200
85 0.088 "-" "curl/8.12.1" yyy.yyy.yyy.yyy 200 0.062
["https://webservice1/"](https://webservice1/)
I would really appreciate any advice or any hint to solve this issue,
because I have to deal with upstreams with multiple nodes.
### Environment
- APISIX version: 3.10.0
- Operating system: Linux
- OpenResty / Nginx: openresty/1.25.3.2
- etcd version, if relevant (run `curl
http://127.0.0.1:9090/v1/server_info`): 3.4.0
- APISIX Dashboard version: 3.0.1
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]