Skip to content

help request: error accessing route after configuring ip-restriction on consumer #9893

Description

@bin-53

Description

When asked to configure the ip-restriction in the consumer, after, can not normally access
the error log is :

2023/07/25 07:12:35 [error] 50#50: *10970426 lua entry thread aborted: runtime error: /usr/local/openresty/lualib/resty/core/request.lua:116: bad argument #1 to 'lower' (string expected, got nil)
stack traceback:
coroutine 0:
        [C]: in function 'lower'
        /usr/local/openresty/lualib/resty/core/request.lua:116: in function '__index'
        /usr/local/apisix/apisix/core/request.lua:103: in function 'header'
        /usr/local/apisix/apisix/plugins/jwt-auth.lua:188: in function 'fetch_jwt_token'
        /usr/local/apisix/apisix/plugins/jwt-auth.lua:355: in function 'phase_func'
        /usr/local/apisix/apisix/plugin.lua:897: in function 'run_plugin'
        /usr/local/apisix/apisix/init.lua:453: in function 'http_access_phase'
        access_by_lua(nginx.conf:303):2: in main chunk, client: 192.168.88.66, server: _, request: "GET /apisixtest/login HTTP/1.1", host: "10.4.16.100:9080"

image

the route cfg:

{
    "id": "470105498213941950",
    "create_time": 1689734312,
    "update_time": 1690269096,
    "uri": "/apisixtest/*",
    "name": "apisix_test",
    "priority": 1,
    "methods": [
        "PUT",
        "DELETE",
        "PATCH",
        "HEAD",
        "OPTIONS",
        "GET",
        "POST"
    ],
    "plugins": {
        "basic-auth": {
            "disable": false
        },
        "proxy-rewrite": {
            "regex_uri": [
                "^/apisixtest(/|$)(.*)",
                "/$2"
            ]
        }
    },
    "upstream": {
        "nodes": [
            {
                "host": "192.168.88.66",
                "port": 9081,
                "weight": 1
            }
        ],
        "retries": 2,
        "timeout": {
            "connect": 6,
            "send": 6,
            "read": 6
        },
        "type": "roundrobin",
        "scheme": "http",
        "pass_host": "pass",
        "keepalive_pool": {
            "idle_timeout": 60,
            "requests": 1000,
            "size": 320
        },
        "retry_timeout": 2
    },
    "status": 1
}

the consumer cfg is :

{
    "username": "basic_ip_res",
    "plugins": {
        "basic-auth": {
            "disable": false,
            "password": "123",
            "username": "xubin"
        },
        "ip-restriction": {
            "blacklist": [
                "10.210.21.152"
            ],
            "disable": false,
            "message": "blacklist"
        }
    },
    "create_time": 1690269000,
    "update_time": 1690269000,
    "consumerNameStr": "basic-auth,ip-restriction"
}

Environment

  • APISIX version (run apisix version):2.15
  • Operating system (run uname -a):
  • OpenResty / Nginx version (run openresty -V or nginx -V):
  • etcd version, if relevant (run curl http://127.0.0.1:9090/v1/server_info):
  • APISIX Dashboard version, if relevant:
  • Plugin runner version, for issues related to plugin runners:
  • LuaRocks version, for installation issues (run luarocks --version):

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    Status
    ✅ Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions