error_page can not work in if directive

xinghua_hi nginx-forum at nginx.us
Tue Dec 25 15:09:45 UTC 2012


thank you very much, but i sitll  want to know why error_page can't work
normally in if block.
I see the error_page 's context can be " if in location" in the document.

the whole location conf  like below, error_page can not work:

 client_max_body_size 50k;
  location / {
            set $var "haha";
            if ($var = "haha") {
                error_page 413 /413.html;
            }
        }

but 

client_max_body_size 50k;
  location / {
             error_page 413 /413.html;
        }
it works!

and 

  location / {
            set $var "haha";
            if ($var = "haha") {
                error_page 404 /404.html;
            }
        }

it  also works! 

thanks!

Posted at Nginx Forum: http://forum.nginx.org/read.php?2,234417,234426#msg-234426



More information about the nginx mailing list