chilcano opened a new issue, #10796:
URL: https://github.com/apache/apisix/issues/10796
### Description
Hi there,
I want to route the traffic to one specific node in a multiple node
upstream. The routing is based on in a word in the `uri`.
I've tried different configurations in the upstream and used `proxy_rewrite`
plugin in the route without success.
This is my upstream `1101`:
```json
{
"name": "App upstream",
"type": "chash",
"hash_on": "header",
"key": "X_MY_HOST",
"scheme": "https",
"pass_host": "pass",
"nodes": {
"mainnet.infura.io": 1,
"goerli.infura.io": 1,
"sepolia.infura.io": 1
}
}
```
> I've tried: `hash_on: vars`, `key:host`, `pass_host:pass` and
`pass_host:node`.
My route is:
```json
{
"name": "App route",
"methods": ["GET", "POST"],
"uri": "/rpc/*",
"plugins": {
"proxy-rewrite": {
"regex_uri": ["^/rpc/(.*)/(.*)", "/v3/$2"],
"headers": {
"HOST": "$1.infura.io",
"X_MY_HOST": "$1.infura.io",
"X_MY_REQUEST_URI": "req_uri_value: $request_uri"
}
}
},
"upstream_id": 1101
}
```
And this is my query:
```sh
curl https://app.gw.local/rpc/sepolia/1234567890 -X POST -s -d '
{
"jsonrpc": "2.0",
"method": "eth_blockNumber",
"params": [],
"id": 1
}'
```
I would like send the request to `sepolia.infura.io` when I call this url
`curl https://app.gw.local/rpc/sepolia/1234567890` and want to avoid to create
many upstream for each node.
I don't know what I'm doing wrong. Any idea is welcome.
Thanks.
### Environment
- APISIX version (run `apisix version`):
- Operating system (run `uname -a`):
- OpenResty / Nginx version (run `openresty -V` or `nginx -V`):
- etcd version, if relevant (run `curl
http://127.0.0.1:9090/v1/server_info`):
- APISIX Dashboard version, if relevant:
- Plugin runner version, for issues related to plugin runners:
- LuaRocks version, for installation issues (run `luarocks --version`):
--
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]