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 .
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 .