Adding $request_path Variable
António P. P. Almeida
appa at perusio.net
Mon Jun 18 08:23:37 UTC 2012
On 17 Jun 2012 02h43 CEST, nginx-forum at nginx.us wrote:
> It would be very nice if someone would add the following variable to
> Nginx:
>
> $request_path
>
> Right now, we have $request_uri which includes the query string of
> the original request. We also have the $uri which is the path
> portion of the $request_uri, but it is the path AFTER the rewrites.
> What would be very useful is the $request_path, which would be the
> original path portion of the $request_uri.
If I understand your problem you want to keep the original URI in a
variable to log it later.
Try setting a variable at the server level. Note that both set and
rewrite happen at the rewrite phase. So if you have server level
rewrites, make sure the variable is set *before* the rewrites appear.
server { #...
set $orig_uri $uri; # $orig_uri is the variable having the
# Rewrites can happen below here
#... log $orig_uri
}
--- appa
More information about the nginx
mailing list