Curl Nginx regex未设置变量
我已经安装了Nginx 1.11.0,我正在尝试基于此正则表达式设置变量:Curl Nginx regex未设置变量,curl,nginx,Curl,Nginx,我已经安装了Nginx 1.11.0,我正在尝试基于此正则表达式设置变量: map $args $foo { "~(^|(?<pre>.*?)&)(cb\=[^&]+)(?<post>.*)" "$pre$post"; default "cat"; } 启动Nginx并运行curl命令时: curl-I localhost:80/?foo=
map $args $foo {
"~(^|(?<pre>.*?)&)(cb\=[^&]+)(?<post>.*)" "$pre$post";
default "cat";
}
启动Nginx并运行curl命令时:
curl-I localhost:80/?foo=test&cb=112&bar=test
我总是得到猫的回应。知道为什么吗?我通过一个在线正则表达式测试仪运行了这个程序,它似乎可以在线运行。我很接近。以下是我一直在寻找的:
“~(^ |)(?*?)\&((cb\=[^&]+)\&)(?*)”
在URL周围使用单引号运行curl命令也有助于避开符号:
curl-I'localhost/?foo=5&cb=234432&bar=test'
proxy_cache_key "$scheme$host$uri$foo";
add_header Cache-Buster "$foo";