Best way to get the $request_uri without the starting slash
Valentin V. Bartenev
ne at vbart.ru
Mon Dec 19 11:07:36 UTC 2011
On Monday 19 December 2011 13:54:33 Matthew Ward wrote:
[...]
>
> So now I have the correct key name for memcached. Are there any better ways
> of doing this? Would this have a serious impact on performance, performing
> this conditional every time? Is it possible do this using set without the
> conditional part?
>
You can utilize "map" module functionality for such tasks, e. g.:
map $request_uri $request_key {
default index;
~^/(.+)$ $1;
}
wbr, Valentin V. Bartenev
More information about the nginx
mailing list