location /endpoint1 {
proxy_set_header Host $host;
header_filter_by_lua_block { ngx.header.content_length = nil }
body_filter_by_lua_block {
local body = ngx.arg[1]
if string.match(body,'"errorfound":"Yes"') then
body = ngx.re.gsub(body, '"errorfound":"Yes"', "myothervar")
end
}
}
location /endpoint2/ {
auth_request /endpoint1;
auth_request_set $auth_status $upstream_status;
rewrite ^/auth/(.*) /$1 break;
}