zhoujiexiong commented on issue #11421:
URL: https://github.com/apache/apisix/issues/11421#issuecomment-2264361342

   @jagerzhang 
   
   `route_test1` also associate with `host test2.com`, so if `route_test1` set 
1st, it has the higher priority(static config with `apisix.yaml` behave like 
this, I will confirm dynamic way using admin API later).
   
   <img width="838" alt="image" 
src="https://github.com/user-attachments/assets/c6fa7f3d-ee24-4cb8-b3c7-030a2269b075";>
   
   
   
   ```
   routes:
     - uri: /test
       hosts: ["test1.com", "test2.com"]
       plugins:
         serverless-pre-function:
           phase: rewrite
           functions:
             - "return function (conf, ctx) ngx.say(\"test1\"); ngx.exit(200) 
end"
             
     - uri: /test
       hosts: ["test2.com"]
       plugins:
         serverless-pre-function:
           phase: rewrite
           functions:
             - "return function (conf, ctx) ngx.say(\"test2\"); ngx.exit(200) 
end"
   
   ```
   
   ```
   curl 127.0.0.1:9080/test -H "host: test2.com"
   test1
   ```
   
   ```
   routes:
     - uri: /test
       hosts: ["test2.com"]
       plugins:
         serverless-pre-function:
           phase: rewrite
           functions:
             - "return function (conf, ctx) ngx.say(\"test2\"); ngx.exit(200) 
end"
   
     - uri: /test
       hosts: ["test1.com", "test2.com"]
       plugins:
         serverless-pre-function:
           phase: rewrite
           functions:
             - "return function (conf, ctx) ngx.say(\"test1\"); ngx.exit(200) 
end"
   ```
   
   ```
   curl 127.0.0.1:9080/test -H "host: test2.com"
   test2
   ```


-- 
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: notifications-unsubscr...@apisix.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to