Replies: 4 comments 15 replies
-
@engimatic Is this your code? Try to troubleshoot it. |
Beta Was this translation helpful? Give feedback.
-
这是我的erverless-pre-function插件代码。 /v1/sys/group/userLike?name=aa。每100次请求,可能出现4-5个参数被截断的问题。post请求json格式的request,都没有出现过问题 |
Beta Was this translation helpful? Give feedback.
-
@tokers 这个是我们做鉴权的自定义插件,目前插件代码运行没有任何问题 |
Beta Was this translation helpful? Give feedback.
-
can you describe this problem clearly? |
Beta Was this translation helpful? Give feedback.
-
Description
插件代码
return function(conf, ctx) local core = require("apisix.core");local http = require("resty.http");local httpc = http.new(); local cjson = require "cjson";local cjson2 = cjson.new();local authorization = core.request.header(ctx, "Authorization"); local uri = ctx.var.uri;if(authorization == nil) then ngx.log(ngx.ERR, "match uri ", uri);core.response.exit(401);return; end;local url = "http://ip:port/checkToken";local req = {};req.uri = uri;req.token = authorization; local res,err = httpc:request_uri(url, {method = "POST", body = cjson2.encode(req), headers = { ["Content-Type"] = "application/json" }});if not res then core.response.exit(500);return;end;local result = cjson2.decode(res.body); if not(result["data"]) then ngx.log(ngx.ERR, "RESULT ", res.body);core.response.exit(res.status, res.body);return;end;end
调用接口/v1/sys/group/userLike?name=aa,连续多次请求,后端发现部分请求url没有name参数,name参数被截断。禁用插件后,没有问题
Environment
Beta Was this translation helpful? Give feedback.
All reactions