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:13:30 UTC

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

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