Welcome! Log In Create A New Profile

Advanced

Re: Random Error Pages to be served using nginx

Igor Sysoev
December 12, 2009 03:12PM
On Sun, Dec 13, 2009 at 12:41:56AM +0530, Harish Sundararaj wrote:

> Hi all,
>
> I'm looking for a way to serve random error pages for 504/502 errors.
> In addition i also want the error pages to be served based on the
> $request_uri.
>
> Something like this:
> 1) When this URL is requested: http://mydomain.com/search?type=ABC
> and if the proxy returns a 504 or 502 and when the GET parameter 'type' has
> 'ABC' as value then serve
> any random document from "/path/to/custom/error/typeABC/"
>
> 2) and the same applies to http://mydomain.com/search?type=DEF just that the
> directory to be used to serve
> error document should be "/path/to/custom/error/typeDEF"
>
> I'm sure this can be achieved with named locations and probably try_files.
> But I'm just not able to get anything working.
>
> Would appreciate some pointers.

../configure --with-http_random_index_module

error_page 502 504 /error/type$arg_type/';

location = /error/typeABC/ {
root /path/to/custom/;
random_index on;
}

location = /error/typeDEF/ {
root /path/to/custom/;
random_index on;
}

# fallback
location /error/type {
root /path/to/custom/;
random_index on;
}


--
Igor Sysoev
http://sysoev.ru/en/

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

Random Error Pages to be served using nginx

Harish Sundararaj December 12, 2009 02:18PM

Re: Random Error Pages to be served using nginx

Igor Sysoev December 12, 2009 03:12PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 244
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