问题如下:
之前写个ngx.location.capture 去获取子请求
代码:
res = ngx.location.capture("/goto_u/category-8888/?keywords=%e7%81%af&level=");
ngx.say(res.status);
ngx.say(res.body);
这个请求到/goto_u/category-8888/?keywords=%e7%81%af&level=,这个的重写是:
location ~ ^/goto_u(.*) {
default_type text/html;
root /data/;
index index.html index.htm;
add_header Cache-Control public;
set $memcached_key $1$is_args$args;
memcached_connect_timeout 180s;
memcached_read_timeout 180s;
memcached_send_timeout 180s;
memcached_buffer_size 256k;
add_header mcache "${host_name}hit";
memcached_pass wapmemc.cdcd.com:11214;
error_page 403 = @get_m_content;
error_page 404 = @get_m_content;
error_page 504 = @get_m_content;
}
location @get_m_content {
default_type text/html;
echo 777888;
}
这时候,nginx没有命中memcahe,就会404 ,理论上是应该走error_page 404 = @get_m_content; 输出777888的,但是没有走这一步
如果我们正常访问/goto_u/category-8888/?keywords=%e7%81%af&level= 这个链接是能正常返回777888的,这是通过ngx.location.capture 请求就不行,请问谁遇到过?或者知道其中原因