Skip to content

bug: /apisix/admin 不能被正确的转发 #3642

@frf12

Description

@frf12

Issue description

/apisix/admin的路径会因为匹配/apisix/admin而被转发给apisix admin模块

Environment

  • apisix version (cmd: apisix version): 2.3
  • OS (cmd: uname -a): centos7
  • OpenResty / Nginx version (cmd: nginx -V or openresty -V):1.19.3.1
  • etcd version, if have (cmd: run curl http://127.0.0.1:9090/v1/server_info to get the info from server-info API):3.4.0
  • apisix-dashboard version, if have:2.3

Minimal test code / Steps to reproduce the issue

1.创建一个路由,将foo.com域名的请求都转发到127.0.0.1:8888

curl http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -i -d '
{
    "name": "test",
    "uri": "/*",
    "hosts": ["foo.com"],
    "methods": ["PUT", "GET"],
    "upstream": {
        "type": "roundrobin",
        "nodes": {
            "127.0.0.1:8888": 1
        }
    }
}'

2.尝试请求http://foo.com/apisix/admin/user/login

curl 'http://foo.com/apisix/admin/user/login' \
  --data-raw '{"username":"admin","password":"admin"}' \
  --compressed \
  --insecure -v

What's the actual result? (including assertion message & call stack if applicable)

返回401。观察logs/error.log发现,请求被认为是apisix admin的请求,被转发到了apisix admin模块。因为请求没有带key,所有返回401

What's the expected result?

请求应该转发到127.0.0.1:8888

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions