Hi,春哥及各位好:
我在做一个测试时,需要使用 ngx.location.capture请求一个404页面并获取error_page指定的内容。发现capture指令对该指令不太支持。使用echo_location测试是支持的。下面是示例:
location /404 {
root html;
error_page 404 = @404_page;
}
location @404_page {
echo "this is my 404 page!";
}
location /404_capture {
content_by_lua '
local res = ngx.location.capture("/404")
ngx.say(res.body)
';
}
location /404_echo {
echo_location /404;
}
curl http://127.0.0.1/404_echo
this is my 404 page!
空
是我的使用方法有问题,还是确实有这个BUG?