本文主要讲述一下nginx lua如何重置请求参数以及整理了几类常量。
local strider = ngx.var.arg_strider
local strider = ngx.req.get_uri_args["strider"]
当请求uri中有多个同名参数时,ngx.var.arg_xx的做法是取第一个出现的值,ngx.req_get_uri_args[“xx”]的做法是返回一个table,该table里存放了该参数的所有值
local args = ngx.req.get_uri_args()
args["userId"]="override value"
ngx.req.set_uri_args(args)
使用实例
ngx.log(ngx.ERR,"error occur in ...")
主要用来设置http 返回状态码
使用实例
if token == nil then
ngx.exit(ngx.HTTP_FORBIDDEN)
end