kingluo commented on issue #7872:
URL: https://github.com/apache/apisix/issues/7872#issuecomment-1239464981

   @ynsdl I made a mistake. I did not update the `conf_id`.
   Here is the updated route config, it should work. Please try it again.
   ```bash
   curl http://127.0.0.1:9080/apisix/admin/routes/test_multi_limit_req  -H 
'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
   {
       "uri": "/get",
       "plugins": {
           "serverless-pre-function": {
               "phase": "access",
               "functions" : ["local lr = 
require(\"apisix.plugins.limit-req\"); local limits = {xxx=1, yyy=10000}; 
return function(conf, ctx) if ctx.var.http_x_yunus_api_key and 
limits[ctx.var.http_x_yunus_api_key] then ctx.conf_id = ctx.conf_id .. \"&\" .. 
ctx.var.http_x_yunus_api_key; local rate = 
limits[ctx.var.http_x_yunus_api_key]; return lr.access({rate = rate, burst = 
rate, rejected_code = 503, key_type = \"var\", key = \"http_x_yunus_api_key\"}, 
ctx); end; end"]
           }
       },
       "upstream": {
           "type": "roundrobin",
           "nodes": {
               "httpbin.org": 1
           }
       }
   }'
   ```
   
   However, it does hack the apisix. So it's better to use workflow plugin, but 
you must build apisix from source, configurer it in config.yaml, and it doesn't 
support dashboard yet. @tzssangglass 


-- 
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