nginx的log_format记录header的字段
文章目录
log_format
log_format main '$http_userId $http_userName $remote_addr $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for" $request_time';
通过http_argname来获取
设置header
ngx.req.set_header("userId",xxx)
ngx.req.set_header("userName",xxx)
在rewrite_by_lua_file里头验证登录之后设置

评论
登录后参与技术讨论,分享你的经验与见解。
登录 / 注册暂无评论