# Multiple error\_page @fallbacks

**URL:** <https://www.ruby-forum.com/t/multiple-error-page-fallbacks/190190>\
**Category:** NGINX\
**Created:** [June 17, 2010, 4:22pm UTC](https://www.ruby-forum.com/t/multiple-error-page-fallbacks/190190 "2010-06-17T16:22:15Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Goldcap](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/ba9def/32.png) [@Goldcap](https://www.ruby-forum.com/u/Goldcap)\
**Post date:** [June 17, 2010, 4:22pm UTC](https://www.ruby-forum.com/t/multiple-error-page-fallbacks/190190/1 "2010-06-17T16:22:15Z")

</div>

Hey Everyone:

I use Nginx with Perl and Memcache, but not sure how to redirect if BOTH  
Perl and Memcached give me a 502… Memcached passes a 502 to the PERL  
script, which if error “should” go to the 502 error page, but it  
doesn’t, with or without the “error\_page” directive in the @fallback.

Sorry if I’m missing something, but is a double-error redirect possible?

As an example, the following results in Nginx’s default error page:

location ~ ^/search/.\* {

```
default_type text/html;
add_header "Content" "text/html; charset=utf8";
charset utf-8;
set $memcached_key $request_uri;
memcached_pass 127.0.0.1:11211;
error_page 404 502 = @fallback;

```

}

location @fallback {

```
gzip off;
fastcgi_pass unix:/var/run/nginx/perl_cgi-dispatch.sock;
fastcgi_param SCRIPT_FILENAME /some/path/to/cgi-bin/search.pl;
include fastcgi_params;

error_page 404 502 = /some/path/to/error.html;

```

}

error\_page 502 /some/path/to/error.html;

Posted at Nginx Forum:

> **[Multiple error\_page @fallbacks](https://forum.nginx.org/read.php?2,98140,98140#msg-98140)**
>
> Hey Everyone: I use Nginx with Perl and Memcache, but not sure how to redirect if BOTH Perl and Memcached give me a 502... Memcached passes a 502 to the PERL script, which if error "should" go to the 502 error page, but it doesn't, with or...

---

<div class="post-metadata">

**Author:** ![Goldcap](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/ba9def/32.png) [@Goldcap](https://www.ruby-forum.com/u/Goldcap)\
**Post date:** [June 17, 2010, 4:22pm UTC](https://www.ruby-forum.com/t/multiple-error-page-fallbacks/190190/2 "2010-06-17T16:22:46Z")

</div>

Nevermind!

recursive\_error\_pages on;

Doh! RTFM!

Thanks.

Posted at Nginx Forum:

> **[Re: Multiple error\_page @fallbacks](https://forum.nginx.org/read.php?2,98140,98148#msg-98148)**
>
> Hey Everyone: I use Nginx with Perl and Memcache, but not sure how to redirect if BOTH Perl and Memcached give me a 502... Memcached passes a 502 to the PERL script, which if error "should" go to the 502 error page, but it doesn't, with or...
