Bishnup1995 commented on issue #9893:
URL: https://github.com/apache/apisix/issues/9893#issuecomment-1993742875

   @shreemaan-abhishek @moonming I am facing a similar issue. Please find my 
configuration below:
   
   **Consumers:**
   ```
   curl http://localhost:9180/apisix/admin/consumers -H 'X-API-KEY: 
edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
   {
       "plugins": {
           "basic-auth": {
               "username": "Developer3",
               "password": "User@123"
           }
       },
       "username": "Developer3",
       "group_id": "admin_users"
   }'
   
   
   
   curl http://localhost:9180/apisix/admin/consumers -H 'X-API-KEY: 
edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
   {
           "plugins": {
               "jwt-auth": {
                   "secret": "$ENV://JWT_SECRET",
                   "key": "Developer2",
                   "exp": 86400
               }
           },
           "username": "Developer2",
           "group_id": "admin_users"
   }'
   ```
   
   **Route :**
   ```
   curl http://localhost:9180/apisix/admin/routes/497215749975180242 -H ' X - 
API - KEY: edd1c9f034335f136f87ad84b625c8f1 ' -X PUT -d '{
       "plugins": {
           "multi-auth": {
                "auth_plugins": [
                         {
                        "basic-auth": {}
                },{
                        "jwt-auth": {}
                    }
                ]
           },
           "proxy-rewrite": {
               "regex_uri": ["^/api/(.*)", "/$1"]
           },
           "response-rewrite": {
               "_meta": {
                   "disable": false
               },
               "filters": [{
                       "replace": "localhost:30075/api",
                       "regex": "localhost:9080",
                       "scope": "global"
                   }
               ]
           },
           "consumer-restriction": {
                   "whitelist": ["admin_users"],
                   "type": "consumer_group_id",
                   "rejected_msg": "Access Dinied",
                   "rejected_code": 403,
                   "_meta": {
                       "disable": false
                   }
           }
       },
       "methods": ["GET", "POST", "PUT", "DELETE", "PATCH", "HEAD", "OPTIONS", 
"CONNECT", "TRACE", "PURGE"],
       "name": "Test api",
       "uri": "/api/*",
       "upstream_id": "497215591497597906"
   }
   ```
   
   **Error in APISIX:**
   ```
   2024/03/13 07:40:09 [error] 56#56: *27373156 lua entry thread aborted: 
runtime error: /usr/local/openresty/lualib/resty/core/request.lua:118: 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:118: in function 
'__index'
           /usr/local/apisix/apisix/core/request.lua:110: in function 'header'
           /usr/local/apisix/apisix/plugins/jwt-auth.lua:182: in function 
'fetch_jwt_token'
           /usr/local/apisix/apisix/plugins/jwt-auth.lua:337: in function 
'rewrite'
           /usr/local/apisix/apisix/plugins/multi-auth.lua:71: in function 
'phase_func'
           /usr/local/apisix/apisix/plugin.lua:1154: in function 'run_plugin'
           /usr/local/apisix/apisix/init.lua:688: in function 
'http_access_phase'
           access_by_lua(nginx.conf:282):2: in main chunk, client: 10.244.64.0, 
server: _, request: "GET /api/test HTTP/1.1", host: "localhost:80"
   ```
   
   curl request:
   `curl  localhost:80/api/test  -H 'Authorization: <jwt-token>' -i`


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to