This commit is contained in:
parent
42fca1fc41
commit
9c397a195e
1 changed files with 4 additions and 5 deletions
|
@ -24,13 +24,12 @@ server {
|
||||||
|
|
||||||
location /UP {
|
location /UP {
|
||||||
access_by_lua_block{
|
access_by_lua_block{
|
||||||
|
local json = require("cjson")
|
||||||
ngx.req.read_body()
|
ngx.req.read_body()
|
||||||
local req = ngx.req.get_body_data()
|
local req = ngx.req.get_body_data()
|
||||||
local newreq, n, err = ngx.re.gsub(req, '\\\\', '\\\\')
|
local newreq = { ["message"] = req }
|
||||||
local newreq, n, err = ngx.re.gsub(newreq, '"', '\\"')
|
local body = json.encode(newreq)
|
||||||
local newreq, n, err = ngx.re.gsub(newreq, "^", "{\"message\":\"")
|
ngx.req.set_body_data(body)
|
||||||
local newreq, n, err = ngx.re.gsub(newreq, "$", "\"}")
|
|
||||||
ngx.req.set_body_data(newreq)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
proxy_set_header Content-Type application/json;
|
proxy_set_header Content-Type application/json;
|
||||||
|
|
Reference in a new issue