Fetching a string by parsing URL
Payam Chychi
pchychi at gmail.com
Wed Jul 22 12:21:39 UTC 2015
On Tuesday, July 21, 2015 at 9:43 PM, sudharshanr wrote:
> I have a web server sitting behind Nginx. If there is an error, then I want
> 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 also
> have 3 paths. So I can't use $1, $2 etc. I need to fetch the last path, i.e
> the path which is immediately followed by the query parameters (the ?
> symbol). Is it possible to do this using Nginx directly?
>
> Thanks.
>
> Posted at Nginx Forum: http://forum.nginx.org/read.php?2,260458,260458#msg-260458
>
> _______________________________________________
> nginx mailing list
> nginx at nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx
>
>
Regex match Might work here?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20150722/7e99f2a5/attachment.html>
More information about the nginx
mailing list