You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by GitBox <gi...@apache.org> on 2022/01/20 13:04:14 UTC

[GitHub] [apisix] fjs-icu opened a new issue #6171: bug: 固定域名转发到泛域名了

fjs-icu opened a new issue #6171:
URL: https://github.com/apache/apisix/issues/6171


   ### Issue description
   
   一个固定的域名 如 a.test1.com 下的路由 转发到 泛域名 上了  *.test1.com
   
   ### Environment
   
   - apisix version (cmd: `apisix version`):  最新版 2.11.0 docker 部署
   - OS (cmd: `uname -a`): centos7
   - OpenResty / Nginx version (cmd: `nginx -V` or `openresty -V`):
   - etcd version, if have (cmd: run `curl http://127.0.0.1:9090/v1/server_info` to get the info from server-info API):
   - apisix-dashboard version, if have:
   - the plugin runner version, if the issue is about a plugin runner (cmd: depended on the kind of runner):
   - luarocks version, if the issue is about installation (cmd: `luarocks --version`):
   
   
   ### Steps to reproduce
   
   
   1. 操作 设置路由: 
   curl http://127.0.0.1:80/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
   {
       "upstream": {
          "nodes": {
              "192.168.0.3:8081": 1
          },
          "type": "roundrobin"
       },
       "hosts": ["*.test1.com"],
       "uris": [ "/v1/*"]
   }'
   
   
   curl http://127.0.0.1:80/apisix/admin/routes/2 -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
   {
       "upstream": {
          "nodes": {
              "192.168.0.3:8082": 1
          },
          "type": "roundrobin"
       },
       "hosts": ["a.test1.com"],
       "uris": ["/*"]
   }'
   
   
   说明 固定域名:a.test1.com  绑定了上游  192.168.0.3:8082  路由为  "uris": ["/*"]
   
   
   ### Actual result
   
   
   2.终端操作
   #  curl -I http://a.test1.com/a 
   
   apisix log:
   [20/Jan/2022:12:51:22 +0000] a.test1.com "HEAD /a HTTP/1.1" 502 0 0.001 "-" "curl/7.29.0" 192.168.0.3:8082 502 0.001 "http://a.test1.com"   
   
   // 注 请求正常
   
   
   # curl -I http://a.test1.com/v1/a
    apisix log:
   [20/Jan/2022:12:51:55 +0000] a.test1.com "HEAD /v1/a HTTP/1.1" 502 0 0.001 "-" "curl/7.29.0" 192.168.0.3:8081 502 0.001 "http://a.test1.com"
   
   ### Error log
   
   
   
   
   //注 请求到另外一台了,理论上 固定的域名的所有的请求 url 应该到 192.168.0.3:8082 这台上。不应该转发到泛域名上。
   
   // 总结 泛域名 过于强大,挡住了固定域名的转发了,应该是属于bug.或者 以上通过什么操作能够解决,请大神解决。
   
   ### Expected result
   
   _No response_


-- 
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-unsubscribe@apisix.apache.org

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



[GitHub] [apisix] tzssangglass commented on issue #6171: bug: why request is forwarded to wildcard API?

Posted by GitBox <gi...@apache.org>.
tzssangglass commented on issue #6171:
URL: https://github.com/apache/apisix/issues/6171#issuecomment-1018083160


   for oper1, the path of request is `/v1/a`, It will be captured by `/v1/*` first, following the depth prefix matching, see: https://github.com/apache/apisix/blob/master/docs/en/latest/router-radixtree.md#3-match-priority
   
   for oper2, the path of request is `/v1/a`, it won't be captured by `/v1/`. 
   
   > doc is error ,A smaller value indicates a higher priority
   > src : If different routes contain the same uri, determine which route is matched first based on the attribute priority. Larger 
   
   Perhaps this is an inaccurate description and priority will work if all other matching conditions are equal.
   
   


-- 
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-unsubscribe@apisix.apache.org

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



[GitHub] [apisix] fjs-icu closed issue #6171: bug: why request is forwarded to wildcard API?

Posted by GitBox <gi...@apache.org>.
fjs-icu closed issue #6171:
URL: https://github.com/apache/apisix/issues/6171


   


-- 
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-unsubscribe@apisix.apache.org

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



[GitHub] [apisix] fjs-icu commented on issue #6171: bug: why request is forwarded to wildcard API?

Posted by GitBox <gi...@apache.org>.
fjs-icu commented on issue #6171:
URL: https://github.com/apache/apisix/issues/6171#issuecomment-1017579148


   
   
   ```
   oper1
   
    curl http://127.0.0.1:80/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
   {
   "upstream": {
   "nodes": {
   "192.168.0.3:8081": 1
   },
   "type": "roundrobin"
   },
   "hosts": ["*.test1.com"],
   "uris": [ "/v1/*"],
   "priority": 1
   }'
   
   curl http://127.0.0.1:80/apisix/admin/routes/2 -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
   {
   "upstream": {
   "nodes": {
   "192.168.0.3:8082": 1
   },
   "type": "roundrobin"
   },
   "hosts": ["a.test1.com"],
   "uris": ["/*"],
   "priority": 10
   }'
   
   curl -I http://a.test1.com/v1/a  
   [20/Jan/2022:14:21:13 +0000] a.test1.com "HEAD /v1/a HTTP/1.1" 502 0 0.000 "-" "curl/7.29.0" 192.168.0.3:8081 502 0.001 "http://a.test1.com"
   
   conclusion : no  matching router   a.test1.com  /*  192.168.0.3:8082
   
   ```
   oper2 
    ```
    curl http://127.0.0.1:80/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
   {
   "upstream": {
   "nodes": {
   "192.168.0.3:8081": 1
   },
   "type": "roundrobin"
   },
   "hosts": ["*.test1.com"],
   "uris": [ "/v1/"],
   "priority": 10
   }'
   
   curl http://127.0.0.1:80/apisix/admin/routes/2 -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
   {
   "upstream": {
   "nodes": {
   "192.168.0.3:8082": 1
   },
   "type": "roundrobin"
   },
   "hosts": ["a.test1.com"],
   "uris": ["/*"],
   "priority": 1
   }'
   curl -I http://a.test1.com/v1/a
   [20/Jan/2022:14:18:36 +0000] a.test1.com "HEAD /v1/a HTTP/1.1" 502 0 0.000 "-" "curl/7.29.0" 192.168.0.3:8082 502 0.001 "http://a.test1.com"
   
   
   conclusion : matching router   a.test1.com  /*  192.168.0.3:8082    ; but priority 1 < "priority": 10 
   
   doc is error ,A smaller value indicates a higher priority
   src : If different routes contain the same uri, determine which route is matched first based on the attribute priority. Larger value means higher priority
   
   
   ```
   


-- 
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-unsubscribe@apisix.apache.org

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



[GitHub] [apisix] tzssangglass commented on issue #6171: bug: why request is forwarded to wildcard API?

Posted by GitBox <gi...@apache.org>.
tzssangglass commented on issue #6171:
URL: https://github.com/apache/apisix/issues/6171#issuecomment-1018143725


   you can use `radixtree_host_uri` as route match. see: https://github.com/apache/apisix/blob/5513f1f66bdd047120936a6b1cc7340741c94366/docs/en/latest/architecture-design/router.md
   
   the `config.yaml` as
   
   ```yaml
   apisix:
     admin_key:
       - name: admin
         key: edd1c9f034335f136f87ad84b625c8f1  # using fixed API token has security risk, please update it when you deploy to production environment
         role: admin
     router:
       http: radixtree_host_uri
   ```
   
   route1
   ```
   curl http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
   {
   "upstream": {
   "nodes": {
   "192.168.0.3:8081": 1
   },
   "type": "roundrobin"
   },
   "hosts": ["*.test1.com"],
   "uris": [ "/v1/*"],
   "priority": 10
   }'
   ```
   
   route2
   ```
   curl http://127.0.0.1:9080/apisix/admin/routes/2 -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
   {
   "upstream": {
   "nodes": {
   "192.168.0.3:8082": 1
   },
   "type": "roundrobin"
   },
   "hosts": ["a.test1.com"],
   "uris": [ "/v1/*"],
   "priority": 1
   }'
   ```
   
   and test
   ```
   curl --resolve "a.test1.com:9080:127.0.0.1" -I http://a.test1.com:9080/v1/a
   ```
   
   the log
   ```
   127.0.0.1 - - [21/Jan/2022:11:49:09 +0800] a.test1.com:9080 "HEAD /v1/a HTTP/1.1" 502 0 15.005 "-" "curl/7.64.1" 192.168.0.3:8082 502 15.005 "http://a.test1.com:9080"
   ```
   
   - the `uris` is same
   - route2's priority less then route1's
   - route2's hosts is is well defined, not regex
   
   Is this what you want?


-- 
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-unsubscribe@apisix.apache.org

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



[GitHub] [apisix] leslie-tsang removed a comment on issue #6171: bug: why request is forwarded to wildcard API?

Posted by GitBox <gi...@apache.org>.
leslie-tsang removed a comment on issue #6171:
URL: https://github.com/apache/apisix/issues/6171#issuecomment-1017509656


   Hello there, try 
   ```shell
   curl http://127.0.0.1:80/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
   {
   "upstream": {
   "nodes": {
   "192.168.0.3:8081": 1
   },
   "type": "roundrobin"
   },
   "hosts": [".test1.com"],
   "uris": [ "/v1/"],
   "priority": 10
   }'
   
   curl http://127.0.0.1:80/apisix/admin/routes/2 -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
   {
   "upstream": {
   "nodes": {
   "192.168.0.3:8082": 1
   },
   "type": "roundrobin"
   },
   "hosts": ["a.test1.com"],
   "uris": ["/*"],
   "priority": 1
   }'
   ```


-- 
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-unsubscribe@apisix.apache.org

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



[GitHub] [apisix] juzhiyuan commented on issue #6171: bug: why request is forwarded to wildcard API?

Posted by GitBox <gi...@apache.org>.
juzhiyuan commented on issue #6171:
URL: https://github.com/apache/apisix/issues/6171#issuecomment-1017490117


   cc @zaunist to have a check 😉


-- 
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-unsubscribe@apisix.apache.org

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



[GitHub] [apisix] zaunist commented on issue #6171: bug: why request is forwarded to wildcard API?

Posted by GitBox <gi...@apache.org>.
zaunist commented on issue #6171:
URL: https://github.com/apache/apisix/issues/6171#issuecomment-1017517814


   > @zaunist Thank you very much
   
   
   
   > 
   
   So is the performance is normal ?


-- 
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-unsubscribe@apisix.apache.org

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



[GitHub] [apisix] leslie-tsang commented on issue #6171: bug: why request is forwarded to wildcard API?

Posted by GitBox <gi...@apache.org>.
leslie-tsang commented on issue #6171:
URL: https://github.com/apache/apisix/issues/6171#issuecomment-1017509656


   Hello there, try 
   ```shell
   curl http://127.0.0.1:80/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
   {
   "upstream": {
   "nodes": {
   "192.168.0.3:8081": 1
   },
   "type": "roundrobin"
   },
   "hosts": [".test1.com"],
   "uris": [ "/v1/"],
   "priority": 10
   }'
   
   curl http://127.0.0.1:80/apisix/admin/routes/2 -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
   {
   "upstream": {
   "nodes": {
   "192.168.0.3:8082": 1
   },
   "type": "roundrobin"
   },
   "hosts": ["a.test1.com"],
   "uris": ["/*"],
   "priority": 1
   }'
   ```


-- 
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-unsubscribe@apisix.apache.org

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



[GitHub] [apisix] zaunist commented on issue #6171: bug: why request is forwarded to wildcard API?

Posted by GitBox <gi...@apache.org>.
zaunist commented on issue #6171:
URL: https://github.com/apache/apisix/issues/6171#issuecomment-1017595967


   cc @tzssangglass. Please take a look, I don't know why the low priority matches first here.


-- 
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-unsubscribe@apisix.apache.org

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



[GitHub] [apisix] zaunist commented on issue #6171: bug: why request is forwarded to wildcard API?

Posted by GitBox <gi...@apache.org>.
zaunist commented on issue #6171:
URL: https://github.com/apache/apisix/issues/6171#issuecomment-1017491486


   > ### Issue description
   > 一个固定的域名 如 a.test1.com 下的路由 转发到 泛域名 上了 *.test1.com
   > 
   > ### Environment
   > * apisix version (cmd: `apisix version`):  最新版 2.11.0 docker 部署
   > * OS (cmd: `uname -a`): centos7
   > * OpenResty / Nginx version (cmd: `nginx -V` or `openresty -V`):
   > * etcd version, if have (cmd: run `curl http://127.0.0.1:9090/v1/server_info` to get the info from server-info API):
   > * apisix-dashboard version, if have:
   > * the plugin runner version, if the issue is about a plugin runner (cmd: depended on the kind of runner):
   > * luarocks version, if the issue is about installation (cmd: `luarocks --version`):
   > 
   > ### Steps to reproduce
   > 1. 操作 设置路由:
   >    curl http://127.0.0.1:80/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
   >    {
   >    "upstream": {
   >    "nodes": {
   >    "192.168.0.3:8081": 1
   >    },
   >    "type": "roundrobin"
   >    },
   >    "hosts": ["_.test1.com"],
   >    "uris": [ "/v1/_"]
   >    }'
   > 
   > curl http://127.0.0.1:80/apisix/admin/routes/2 -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d ' { "upstream": { "nodes": { "192.168.0.3:8082": 1 }, "type": "roundrobin" }, "hosts": ["a.test1.com"], "uris": ["/*"] }'
   > 
   > 说明 固定域名:a.test1.com 绑定了上游 192.168.0.3:8082 路由为 "uris": ["/*"]
   > 
   > ### Actual result
   > 2.终端操作 //# curl -I http://a.test1.com/a
   > 
   > apisix log: [20/Jan/2022:12:51:22 +0000] a.test1.com "HEAD /a HTTP/1.1" 502 0 0.001 "-" "curl/7.29.0" 192.168.0.3:8082 502 0.001 "http://a.test1.com"
   > 
   > // 注 请求正常
   > 
   > //# curl -I http://a.test1.com/v1/a apisix log: [20/Jan/2022:12:51:55 +0000] a.test1.com "HEAD /v1/a HTTP/1.1" 502 0 0.001 "-" "curl/7.29.0" 192.168.0.3:8081 502 0.001 "http://a.test1.com"
   > 
   > ### Error log
   > //注 请求到另外一台了,理论上 固定的域名的所有的请求 url 应该到 192.168.0.3:8082 这台上。不应该转发到泛域名上。
   > 
   > // 总结 泛域名 过于强大,挡住了固定域名的转发了,应该是属于bug.或者 以上通过什么操作能够解决,请大神解决。
   > 
   > ### Expected result
   > _No response_
   
   You can set `priority` to distinguish both route. ref [apisix route](https://apisix.apache.org/zh/docs/apisix/admin-api#body-%E8%AF%B7%E6%B1%82%E5%8F%82%E6%95%B0)


-- 
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-unsubscribe@apisix.apache.org

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



[GitHub] [apisix] fjs-icu commented on issue #6171: bug: why request is forwarded to wildcard API?

Posted by GitBox <gi...@apache.org>.
fjs-icu commented on issue #6171:
URL: https://github.com/apache/apisix/issues/6171#issuecomment-1018167074


   @tzssangglass Thank you very much,You are excellent.


-- 
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-unsubscribe@apisix.apache.org

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



[GitHub] [apisix] zaunist commented on issue #6171: bug: why request is forwarded to wildcard API?

Posted by GitBox <gi...@apache.org>.
zaunist commented on issue #6171:
URL: https://github.com/apache/apisix/issues/6171#issuecomment-1017525709


   > 
   
   So what' problem? Please describe more detail.


-- 
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-unsubscribe@apisix.apache.org

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



[GitHub] [apisix] fjs-icu commented on issue #6171: bug: why request is forwarded to wildcard API?

Posted by GitBox <gi...@apache.org>.
fjs-icu commented on issue #6171:
URL: https://github.com/apache/apisix/issues/6171#issuecomment-1018125429


   @tzssangglass   for oper1 and oper3 and oper4 : router priority  hight >  host , 
   
   but  I want to http://a.test1.com/v1/a  match routes/2 ("hosts": ["a.test1.com"] "192.168.0.3:8082")  ;That is  a.test1.com > *.test1.com ; a.test1.com  > *.test1.com , host > priority,  Do you know what I mean?
   
   oper3:
   ```
   curl http://127.0.0.1:80/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
   {
   "upstream": {
   "nodes": {
   "192.168.0.3:8081": 1
   },
   "type": "roundrobin"
   },
   "hosts": ["*.test1.com"],
   "uris": [ "/v1/*"]
   }'
   
   curl http://127.0.0.1:80/apisix/admin/routes/2 -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
   {
   "upstream": {
   "nodes": {
   "192.168.0.3:8082": 1
   },
   "type": "roundrobin"
   },
   "hosts": ["a.test1.com"],
   "uris": ["/*"]
   }'
   ```
   curl -I http://a.test1.com/v1/a
   apisix log:
   [20/Jan/2022:12:51:55 +0000] a.test1.com "HEAD /v1/a HTTP/1.1" 502 0 0.001 "-" "curl/7.29.0" 192.168.0.3:8081 502 0.001 "http://a.test1.com"
   
   http://a.test1.com/v1/a  --> *.test1.com, 192.168.0.3:8081 
   
   
   =========================
   oper4 : 
   ```
   	
   curl http://127.0.0.1:80/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
   {
   "upstream": {
   "nodes": {
   "192.168.0.3:8081": 1
   },
   "type": "roundrobin"
   },
   "hosts": ["*.test1.com"],
   "uris": [ "/v1/*"]
   }'
   
   curl http://127.0.0.1:80/apisix/admin/routes/2 -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
   {
   "upstream": {
   "nodes": {
   "192.168.0.3:8082": 1
   },
   "type": "roundrobin"
   },
   "hosts": ["a.test1.com"],
   "uris": ["/*"],
   "vars": [ 
   	["http_host", "==", "a.test1.com"]
   ]
   }'
   
   ```
   curl -I http://a.test1.com/v1/a
   apisixlog:   a.test1.com "HEAD /v1/a HTTP/1.1" 502 0 0.001 "-" "curl/7.29.0" 192.168.0.3:8081 502 0.001 "http://a.test1.com"
   
    http://a.test1.com/v1/a  --> *.test1.com 192.168.0.3:8081 


-- 
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-unsubscribe@apisix.apache.org

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



[GitHub] [apisix] fjs-icu commented on issue #6171: bug: why request is forwarded to wildcard API?

Posted by GitBox <gi...@apache.org>.
fjs-icu commented on issue #6171:
URL: https://github.com/apache/apisix/issues/6171#issuecomment-1017508559


   @zaunist 
   curl http://127.0.0.1:80/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
   {
       "upstream": {
          "nodes": {
              "192.168.0.3:8081": 1
          },
          "type": "roundrobin"
       },
       "hosts": ["*.test1.com"],
       "uris": [ "/v1/*"],
   	"priority": 1
   }'
   
   
   curl http://127.0.0.1:80/apisix/admin/routes/2 -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
   {
       "upstream": {
          "nodes": {
              "192.168.0.3:8082": 1
          },
          "type": "roundrobin"
       },
       "hosts": ["a.test1.com"],
       "uris": ["/*"],
   	"priority": 10
   }'
   
   a.test1.com  set priority 10  192.168.0.3:8082
   
   but:
   //# curl -I http://a.test1.com/v1/a
    [20/Jan/2022:13:30:12 +0000] a.test1.com "HEAD /v1/a HTTP/1.1" 502 0 0.001 "-" "curl/7.29.0" 192.168.0.3:8081 502 0.000 "http://a.test1.com"
   
   Higher priority routes no matched 
   
   


-- 
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-unsubscribe@apisix.apache.org

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



[GitHub] [apisix] fjs-icu commented on issue #6171: bug: why request is forwarded to wildcard API?

Posted by GitBox <gi...@apache.org>.
fjs-icu commented on issue #6171:
URL: https://github.com/apache/apisix/issues/6171#issuecomment-1017523535


   @zaunist  Thank you very much :
   > "hosts": [".test1.com"],
   > "uris": [ "/v1/"],
   > "priority": 10
   
   > "hosts": ["a.test1.com"],
   > "uris": ["/*"],
   > "priority": 1
   
   ret: 
   [20/Jan/2022:13:35:42 +0000] a.test1.com "HEAD /v1/a HTTP/1.1" 502 0 0.001 "-" "curl/7.29.0" 192.168.0.3:8082 502 0.001 "http://a.test1.com"
   
   The result is correct   ; ok  ok .
   
   
   but
    priority :
   If different routes contain the same uri, determine which route is matched first based on the attribute priority. Larger value means higher priority. The default value is 0.
   ![image](https://user-images.githubusercontent.com/77909390/150351279-ce49a9c0-bcb2-4dfc-8fc1-d0b7f47aa7a4.png)
   
   


-- 
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-unsubscribe@apisix.apache.org

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



[GitHub] [apisix] zaunist edited a comment on issue #6171: bug: why request is forwarded to wildcard API?

Posted by GitBox <gi...@apache.org>.
zaunist edited a comment on issue #6171:
URL: https://github.com/apache/apisix/issues/6171#issuecomment-1017491486


   > ### Issue description
   > 一个固定的域名 如 a.test1.com 下的路由 转发到 泛域名 上了 *.test1.com
   > 
   > ### Environment
   > * apisix version (cmd: `apisix version`):  最新版 2.11.0 docker 部署
   > * OS (cmd: `uname -a`): centos7
   > * OpenResty / Nginx version (cmd: `nginx -V` or `openresty -V`):
   > * etcd version, if have (cmd: run `curl http://127.0.0.1:9090/v1/server_info` to get the info from server-info API):
   > * apisix-dashboard version, if have:
   > * the plugin runner version, if the issue is about a plugin runner (cmd: depended on the kind of runner):
   > * luarocks version, if the issue is about installation (cmd: `luarocks --version`):
   > 
   > ### Steps to reproduce
   > 1. 操作 设置路由:
   >    curl http://127.0.0.1:80/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
   >    {
   >    "upstream": {
   >    "nodes": {
   >    "192.168.0.3:8081": 1
   >    },
   >    "type": "roundrobin"
   >    },
   >    "hosts": ["_.test1.com"],
   >    "uris": [ "/v1/_"]
   >    }'
   > 
   > curl http://127.0.0.1:80/apisix/admin/routes/2 -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d ' { "upstream": { "nodes": { "192.168.0.3:8082": 1 }, "type": "roundrobin" }, "hosts": ["a.test1.com"], "uris": ["/*"] }'
   > 
   > 说明 固定域名:a.test1.com 绑定了上游 192.168.0.3:8082 路由为 "uris": ["/*"]
   > 
   > ### Actual result
   > 2.终端操作 //# curl -I http://a.test1.com/a
   > 
   > apisix log: [20/Jan/2022:12:51:22 +0000] a.test1.com "HEAD /a HTTP/1.1" 502 0 0.001 "-" "curl/7.29.0" 192.168.0.3:8082 502 0.001 "http://a.test1.com"
   > 
   > // 注 请求正常
   > 
   > //# curl -I http://a.test1.com/v1/a apisix log: [20/Jan/2022:12:51:55 +0000] a.test1.com "HEAD /v1/a HTTP/1.1" 502 0 0.001 "-" "curl/7.29.0" 192.168.0.3:8081 502 0.001 "http://a.test1.com"
   > 
   > ### Error log
   > //注 请求到另外一台了,理论上 固定的域名的所有的请求 url 应该到 192.168.0.3:8082 这台上。不应该转发到泛域名上。
   > 
   > // 总结 泛域名 过于强大,挡住了固定域名的转发了,应该是属于bug.或者 以上通过什么操作能够解决,请大神解决。
   > 
   > ### Expected result
   > _No response_
   
   You can set `priority` to distinguish both route. ref [apisix route](https://apisix.apache.org/zh/docs/apisix/admin-api#body-%E8%AF%B7%E6%B1%82%E5%8F%82%E6%95%B0). Higher priority routes will be matched first


-- 
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-unsubscribe@apisix.apache.org

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



[GitHub] [apisix] fjs-icu commented on issue #6171: bug: why request is forwarded to wildcard API?

Posted by GitBox <gi...@apache.org>.
fjs-icu commented on issue #6171:
URL: https://github.com/apache/apisix/issues/6171#issuecomment-1017512929


   @zaunist Thank you very much


-- 
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-unsubscribe@apisix.apache.org

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