Hi,
I am working on nginx server that uses Lua for rewriting requests.
I need to redirect rewritten url without it trying once more to find a match with other locations.
So for example.
Request /test
will be rewritten to /user
and sent to server without trying to match location /user
location /user {
add_header Content-Type text/plain;
return 200 "dont go here";
}
location /test {
rewrite_by_lua_block {
local uri = ngx.re.sub(ngx.var.uri, "^.*", "/user")
ngx.req.set_uri(uri, false)
}
proxy_pass http://upstream;
}
This works but rewritten url doesn't show in browser address, it is
just silently redirected. How do I make it show up in browser as a new
url?
ngx.redirect
is not an option I think, it will change browser url but it will try to match again with location which i need to prevent.
I am basically trying to emulate Apaches [L] flag
Any info would be appreciated. Thank you