kingluo commented on issue #7872: URL: https://github.com/apache/apisix/issues/7872#issuecomment-1238839412
@ynsdl Another solution is to use serverless: ```bash curl http://127.0.0.1:9180/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=1}; return function(conf, ctx) if ctx.var.http_x_yunus_api_key and limits[ctx.var.http_x_yunus_api_key] then 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 } } }' ``` Here you could adjust `limits` table in the code to fit your need. -- 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]
