error_page can not work in if directive

xinghua_hi nginx-forum at
Tue Dec 25 13:06:45 UTC 2012

I want to display different pages when 413 code return, for example

set $var 1;
if ($var = 1) {
     error_page 413 /413_old.html;
if ($var =2) {
    error_page 413 /413_new.html;

 error_page can not work, but I write error_page directive in location block
directly instead of using if directive, it can work normally

Posted at Nginx Forum:,234417,234417#msg-234417

More information about the nginx mailing list