zhoujiexiong commented on issue #11437:
URL: https://github.com/apache/apisix/issues/11437#issuecomment-2265055054
> I have both _.test.com/xxx/_ and foo.test.com/* routes if no have
foo.test.com/* , i can access foo .test.com/xxx/* I adjusted the priority value
, not work
>
> but i can use it on v3.2.2
>
> { "uri": "/xxx/_", "name": "xxx", "priority": 100, "methods": [ "GET",
"POST", "PUT", "DELETE", "PATCH", "HEAD", "OPTIONS", "CONNECT", "TRACE",
"PURGE" ], "host": "_.test.com", "upstream": { "nodes": [ { "host":
"192.168.88.11", "port": 19000, "weight": 1 } ], "timeout": { "connect": 6,
"send": 600, "read": 600 }, "type": "roundrobin", "hash_on": "vars", "scheme":
"http", "pass_host": "pass", "keepalive_pool": { "idle_timeout": 60,
"requests": 1000, "size": 320 } }, "enable_websocket": true, "status": 1 }
>
> like this

@GitHubLoveKe
Simulated the case you just provided, It's also no problem. :D
`foo.test.com/xxx/foo` is reachable via new added route `11437_foo`.
<img width="833" alt="image"
src="https://github.com/user-attachments/assets/00fdd710-24eb-4142-8ed2-d6a712447407">
```
use t::APISIX 'no_plan';
repeat_each(1);
no_long_string();
no_shuffle();
no_root_location();
run_tests;
__DATA__
=== TEST 1: try reproduce issue #11437
--- config
location = /t {
content_by_lua_block {
local t = require("lib.test_admin").test
local code, body = t('/apisix/admin/routes/11437',
ngx.HTTP_PUT,
[[{
"plugins": {
"serverless-pre-function": {
"phase": "rewrite",
"functions": [
"return function (conf, ctx)
ngx.print(\"11437\"); ngx.exit(200) end"
]
}
},
"hosts": ["*.test.com"],
"uri": "/xxx/*"
}]]
)
assert(body == "passed")
local code, body = t('/apisix/admin/routes/11437_foo',
ngx.HTTP_PUT,
[[{
"plugins": {
"serverless-pre-function": {
"phase": "rewrite",
"functions": [
"return function (conf, ctx)
ngx.print(\"11437_foo\"); ngx.exit(200) end"
]
}
},
"hosts": ["foo.test.com"],
"uri": "/*"
}]]
)
assert(body == "passed")
ngx.sleep(3)
local http = require "resty.http"
local httpc = http.new()
local uri1 = "http://127.0.0.1:" .. ngx.var.server_port ..
"/xxx/foo"
local res, err = httpc:request_uri(uri1, { method = "GET",
headers = { Host = "foo.test.com" }})
if err then
ngx.log(ngx.ERR, err)
ngx.status = res.status
return
end
ngx.say(res.body)
}
}
--- request
GET /t
--- response_body
11437_foo
--- timeout: 30
```
--
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]