some of my customers wants to ignore sending query string as they need maximum use of valid caches and ignore ddos and ... attacks with random query strings. their site doesn't use query string.
so all I wanna say and do is to ignore sending query string to their origin server and also ignore it in cacheid generation! in other words, I wanna remove full url query string of clients request for those customers!
but openresty builtin mechanism doesn't allow me to do that but just by redirection!
even I can't do that using:
if string.find(ngx.var.request_uri,"?",1, true) then
local args = ngx.req.get_uri_args()
for k , v in pairs(args) do
args[k]=nil;
--ngx.log(ngx.DEBUG,tostring(k) .. " --> " .. tostring(v))
end
ngx.req.set_uri_args(args)
--return ngx.redirect(ngx.var.scheme .. "://" .. ngx.var.host..uri_without_query_str, 301)
end
ngx.log(ngx.DEBUG,"============> " .. tostring(ngx.var.request_uri))
--nothing is changed