1.要先安装OpenResty的环境,安装地址 http://openresty.org/cn/installation.html
2.配置nginx.conf
location ^~ /business/ {
default_type application/json;
rewrite_by_lua_file /zzserver/acm/nginx/lua-code/error-service.lua;
access_by_lua_file /zzserver/acm/nginx/lua-code/tr-jwt-auth.lua;
proxy_pass http://localhost:8316/business/;
body_filter_by_lua_file /zzserver/acm/nginx/lua-code/post-handle-body.lua;
}
post-handle-body.lua的内容
local userAccount = ngx.header["User-Account"]
if userAccount == nil then userAccount = '' end if ngx.status == 500 then ngx.log(ngx.ERR, "failed request on current user:" .. userAccount) elseif ngx.status == 409 then local resp_body = string.sub(ngx.arg[1], 1, 1000) ngx.log(ngx.ERR, "conflict request on current user:" .. userAccount .. "======response body:" .. resp_body) end
tr-jwt-auth.lua的内容
local userAccount = ngx.header["User-Account"]
if userAccount == nil then userAccount = '' end if ngx.status == 500 then ngx.log(ngx.ERR, "failed request on current user:" .. userAccount) elseif ngx.status == 409 then local resp_body = string.sub(ngx.arg[1], 1, 1000) ngx.log(ngx.ERR, "conflict request on current user:" .. userAccount .. "======response body:" .. resp_body) end
- 消灭零回复
- 热议问题
-
日志租户数据分库隔离
1
-
dicUrl不知道怎么使用crypto进行加密
1
-
需要改返回值对象的请求头 给CDN做缓存
1
-
Clock moved backwards. Refusing to generate id for 170 milliseconds
1
-
在Bladex中开启乐观锁,启动gateway项目报错
1
-
saber3 4.5.0不支持一级菜单?
1
-
微服务版本,redis设置密码无法连接
2
-
2.8.0配置多数据源不生效
1
-
avue-data大屏设计器运行报错:签名认证失败
1
-
物联分支合并问题?
1
官方新品
扫一扫访问 Blade技术社区 移动端