jagerzhang opened a new issue, #11421:
URL: https://github.com/apache/apisix/issues/11421
### Current Behavior
## reproduce steps
### config.yml
```yaml
apisix:
node_listen: 9080 # APISIX listening port
enable_ipv6: false
allow_admin: #
http://nginx.org/en/docs/http/ngx_http_access_module.html#allow
- 0.0.0.0/0 # We need to restrict ip access rules for
security. 0.0.0.0/0 is for test.
router:
http: radixtree_host_uri
admin_key:
- name: "admin"
key: edd1c9f034335f136f87ad84b625c8f1
role: admin # admin: manage all configuration data
# viewer: only can view configuration data
- name: "viewer"
key: 4054f7cf07e344346cd3f287985e76a2
role: viewer
enable_control: true
control:
ip: "0.0.0.0"
port: 9092
nginx_config:
user: root
error_log: /dev/stdout
error_log_level: error
enable_cpu_affinity: false
http:
enable_access_log: false # enable access log or not, default true
etcd:
host: # it's possible to define multiple etcd
hosts addresses of the same etcd cluster.
- "http://127.0.0.1:2379" # multiple etcd address
prefix: "/apisix" # apisix configurations prefix
timeout: 30 # 30 seconds
plugin_attr:
prometheus:
export_addr:
ip: "0.0.0.0"
port: 9091
```
### create upstream
```shell
curl -X PUT http://127.0.0.1:9080/apisix/admin/upstreams/test -H 'X-API-KEY:
edd1c9f034335f136f87ad84b625c8f1' -d '{
"nodes": [
{
"host": "127.0.0.1",
"port": 8000,
"weight": 100
}
],
"timeout": {
"connect": 6,
"send": 60,
"read": 60
},
"type": "roundrobin",
"scheme": "http",
"pass_host": "pass"
}'
```
### create service
```shell
curl -X PUT http://127.0.0.1:9080/apisix/admin/services/test -H 'X-API-KEY:
edd1c9f034335f136f87ad84b625c8f1' -d'{
"upstream_id": "test",
"hosts": ["test1.com", "test2.com"]
}'
```
### create route1 without hosts
```shell
curl -X PUT http://127.0.0.1:9080/apisix/admin/routes/test1 -H 'X-API-KEY:
edd1c9f034335f136f87ad84b625c8f1' -d '{
"uris": [
"/test*"
],
"name": "test1",
"methods": [
"GET"
],
"plugins": {
"echo": {
"body": "test1\n"
}
},
"service_id": "test",
"status": 1
}'
```
### create route2 with hosts
```shell
curl -X PUT http://127.0.0.1:9080/apisix/admin/routes/test2 -H 'X-API-KEY:
edd1c9f034335f136f87ad84b625c8f1' -d '{
"uris": [
"/test*"
],
"name": "test2",
"methods": [
"GET"
],
"plugins": {
"echo": {
"body": "test2\n"
}
},
"hosts": ["test2.com"],
"service_id": "test",
"status": 1
}'
```
### request test
```shell
[root@centos test]# curl http://127.0.0.1:9080/test -H "host: test1.com"
test1
[root@centos test]# curl http://127.0.0.1:9080/test -H "host: test2.com"
test1
```
## In `radixtree_host_uri` mode, why `test2.com` match the route `test1`
rather than the route test2 ?
### Expected Behavior
`test2.com` is bound to `route2` and should be prioritized for matching to
`route2`
### Error Logs
_No response_
### Steps to Reproduce
Run With apache/apisix:2.15.0-centos Docker image.
### Environment
- APISIX version (run `apisix version`): 2.15 Docker centos
--
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]