local strider = ngx.var.arg_strider
local strider = ngx.req.get_uri_args[“strider”]
location /book {
set_by_lua $to_type '
local skuId = ngx.var.arg_skuId
ngx.log(ngx.ERR,"skuId=",skuId)
local r = ngx.re.match(skuId, "^[0-9]{8}$")
local k = ngx.re.match(skuId, "^[0-9]{9}$")
if r then
return "1"
end;
if k then
return "2"
end;
';
if ($to_type = "1") {
echo "skuId为8位" ;
proxy_pass http://127.0.0.1/old_book/$arg_skuId.html;
}
if ($to_type = "2") {
echo "skuId为9位" ;
proxy_pass http://127.0.0.1/new_book/$arg_skuId.html;
}
}