Multiple error_page @fallbacks

Goldcap nginx-forum at nginx.us
Tue Jun 15 00:34:29 MSD 2010


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: http://forum.nginx.org/read.php?2,98140,98140#msg-98140




More information about the nginx mailing list