Fetching a string by parsing URL

Edho Arief me at myconan.net
Wed Jul 22 04:55:30 UTC 2015

On Jul 22, 2015 11:43, "sudharshanr" <nginx-forum at nginx.us> wrote:
> I have a web server sitting behind Nginx. If there is an error, then I
> to fetch some information from the url and pass it on to a static file as
> parameters. I have configured Nginx to fetch the query parameters from the
> url using $arg_param_name.
> However, I also need to fetch a String from the url path itself. For
> instance, if the url is "www.website.com/path1/path2?arg1=val&arg2=someval
> how can I parse this url to fetch the last path (path2 in this case)? My
> location directive is as below:
> location ~*/path1/{
>    ...
> }
> The url, however, need not always have the same number of paths. It can
> have 3 paths. So I can't use $1, $2 etc. I need to fetch the last path,
> the path which is immediately followed by the query parameters (the ?
> symbol). Is it possible to do this using Nginx directly?

this? /([^/]+/?)$

> Thanks.
> Posted at Nginx Forum:
> _______________________________________________
> nginx mailing list
> nginx at nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20150722/bddb4c92/attachment.html>

More information about the nginx mailing list