我有以下位置配置:
location ~ ^/(trucks|cars|planes|system|tools) {
auth_basic "Restricted";
auth_basic_user_file /etc/nginx/htauth_file;
proxy_set_header Host "server.lan";
proxy_set_header X-Real-IP $remote_addr;
proxy_pass http://127.0.0.1:8080$request_uri;
}
当任何人向
发出请求时/卡车
或
/汽车
等,我希望它们通过基本身份验证进行身份验证。但是当有人提出要求时
/卡车?ID = 123
或
/车?ID = 124
然后我不需要身份验证,处理较低的位置块。
当URI中有问号时,我基本上不希望该位置匹配。
有没有办法修改我的粘贴配置,以便在URI中有问号时它不匹配?
答案 0 :(得分:2)
我建议使用以下正则表达式:
<input id="addButton" type="button" value="Add">
$(document).on("click","#addButton",function(){
var searchedValue = $('#search_term').val();
var divHolder = $('#selectedStuff');
divHolder.append(searchedValue + '<br>');
});
答案 1 :(得分:1)
尝试以下正则表达式:
/cars <--match
/trucks <--match
/trucks?id=123 <-- no match
它会:
{{1}}