Welcome! Log In Create A New Profile

Advanced

Re: Fetching a string by parsing URL

Edho Arief
July 22, 2015 02:14PM
On Thu, Jul 23, 2015 at 2:08 AM, sudharshanr <nginx-forum@nginx.us> wrote:
> I think I need to rephrase my question. Right now, my nginx.conf looks like
> this:
>
> location ~*/path1/{
> if (-f $document_root/error503.html) {
> return 503;
> }
> }
>
> error_page 503 <path_to_static_file>?arg1=$arg_queryparam1&arg2=<last path
> from url>
>
> As you can see, if there is a 503 error, then I return a static file. The
> arguments to the static file are:
> 1. the param from url whose name is queryparam1,
> 2. the last path from the url
>
> Now how do I fetch the last path from the url and pass it as a param to the
> static file? I'm new to Nginx, so I'm not sure if I'm doing this right.
>


map $uri $last_path {
~/(?<pathname>[^/]+)/?$ $pathname;
}

server {
...
error_page ... ...=$last_path;
}


Note that nothing will see the arguments if the error page is just a
static file and not a redirect.

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

Fetching a string by parsing URL

sudharshanr July 22, 2015 12:43AM

Re: Fetching a string by parsing URL

Edho Arief July 22, 2015 12:56AM

Re: Fetching a string by parsing URL

sudharshanr July 22, 2015 02:17AM

Re: Fetching a string by parsing URL

unclepieman July 22, 2015 08:22AM

Re: Fetching a string by parsing URL

sudharshanr July 22, 2015 01:08PM

Re: Fetching a string by parsing URL

Edho Arief July 22, 2015 02:14PM

Re: Fetching a string by parsing URL

sudharshanr July 22, 2015 07:31PM

Re: Fetching a string by parsing URL

sudharshanr July 23, 2015 02:36PM

Re: Fetching a string by parsing URL

sudharshanr July 23, 2015 03:32PM

Re: Fetching a string by parsing URL

Francis Daly July 24, 2015 06:54PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 230
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready