huangyutongs commented on issue #9830:
URL: https://github.com/apache/apisix/issues/9830#issuecomment-1635464561

   > > I want to do limit-req for the request header `x-userid: test`, how to 
do it,
   > 
   > I think you can reference it with $http_x_userid
   
   It seems that the content of the request header cannot be obtained
   Here is my configuration
   ```
   apiVersion: apisix.apache.org/v2
   kind: ApisixRoute
   metadata:
     name: apisix-dashbord-route
   spec:
     http:
     - backends:
       - serviceName: apisix-dashboard
         servicePort: 80
       match:
         hosts:
         - apisixui.baidu.cn
         paths:
         - /*
       name: apisix-dashbord-route
       plugins:
       - config:
           burst: 0
           key: $http_x_userid
           key_type: var_combination
           rate: 1
           rejected_code: 500
           rejected_msg: Requests are too frequent, please try again later.
         enable: true
         name: limit-req
   ```
   Quickly make two requests
   ```
   curl -I 192.168.110.186 -H "host: apisixui.baidu.cn"
   HTTP/1.1 500 Internal Server Error
   ```
   There is no x-userid: test in my request header, but it is limited
   
   


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

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

Reply via email to