It is my problem:
I need functions:
1) change source url (delete exactly params)
2) redirect to other host
3) get request and response for save to logs
my proxy listening SOURCE_HOST:PORT
I get request like this SOURCE_HOST:PORT/path/path/variable?param_for_delete=345¶m_must_be=356453
need redirect to NEW_HOST:PORT/path/path/variable?param_must_be=356453
my solution at this moment:
listen PORT;
server_name name;
location / {
access_by_lua_block{
ngx.req.read_body()
local args = ngx.req.get_uri_args()
args.param_for_delete = nil
ngx.req.set_uri_args(args)
}
proxy_pass NEW_HOST:PORT;
}
But I have wrong request NEW_HOST:PORT/path/path/variable?param_for_delete=345¶m_must_be=356453
what am I doing wrong?