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 
![image](https://private-user-images.githubusercontent.com/17232388/354545759-c17647a3-9d30-4029-89ad-ba85188cc40a.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjI1OTI2MjQsIm5iZiI6MTcyMjU5MjMyNCwicGF0aCI6Ii8xNzIzMjM4OC8zNTQ1NDU3NTktYzE3NjQ3YTMtOWQzMC00MDI5LTg5YWQtYmE4NTE4OGNjNDBhLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MDIlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODAyVDA5NTIwNFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWE5MWMxZjBlOThlOWIxOWVlYmRlZDM2MzlkMDNlMjAyNjU4YmE0N2QzZTJiYTFkNTNiNDdlM2M1ZTQ3MzQ5MmImWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.PF_Oq3s0aaDT4_vLBAcTNZKueYrCJXWz5LTf5A_H9jg)
   
   @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]

Reply via email to