我正在尝试匹配这些,以便它们代理到另一个URL。总会出现一些事情,但事情并非总是如此。
我知道我可以为每个案例使用新规则,但是,如果可能的话,我试图找到一种通用方法。
我现在有这个:
location ^~ /([^/]*foo[^/]+)/ {
proxy_pass https://localhost:8080/$1;
}
答案 0 :(得分:0)
我有这个正则表达式:
([^\/]*foo[^\/]*)
1st Capturing group ([^\/]*foo[^\/]*)
[^\/]* match a single character not present in the list below
Quantifier: * Between zero and unlimited times, as many times as possible, giving back as needed [greedy]
\/ matches the character / literally
foo matches the characters foo literally (case sensitive)
[^\/]* match a single character not present in the list below
Quantifier: * Between zero and unlimited times, as many times as possible, giving back as needed [greedy]
\/ matches the character / literally
g modifier: global. All matches (don't return on first match)