error_page can not work in if directive
xinghua_hi
nginx-forum at nginx.us
Tue Dec 25 16:47:58 UTC 2012
thanks, but a new question comming。
I try to resolve my problem according to your method:
(1)
“set" is also an location-level rewrite module directive, so the conf like
this
location / {
root XXX;
set $var "haha";
error_page 413 /413.${var}.html;
}
will return 404, but 413.haha.html exists my root dir。I see the debug log ,
find some log like
http finalize request: 404, "/413..html?"
obviously, nginx takes $var as an empty string, I think the reason is also
that 413 error is generated before set directive? so , how to use variable
in error_page uri?
(2)
if I writer conf like this:
location / {
set $var "haha";
error_page 413 /413.html;
}
location = /413.html {
if ($var) {
rewriter ^ /413.new.html;
}
}
the key problem is how can i pass the $var to location /413.html? I try
it , the second $var is empty(I also wonder about the result because I
remember when internal redirect, the location can share the variable) 。
Thank you .
Posted at Nginx Forum: http://forum.nginx.org/read.php?2,234417,234437#msg-234437
More information about the nginx
mailing list