以下の URL を PCRE と一致させるにはどうすればよいですか。
http://www.test.com/abc?v=123&feature=True
http://www.test.com/def?v=456&feature=True
私がやろうとしているのは、ドメインの下のパス (abc または def) を一致させて、nginx を使用して指定したホストにリクエストをリダイレクトできるようにすることです。
#content of /etc/nginx/sites-enabled/default
location / {
#default redirect
proxy_pass http://www.google.com;
#redirect by domain name.
if ($path ~* abc)
{
proxy_pass http://10.1.1.47:8081?v=123&feature=True;
}
if ($path ~* edf)
{
proxy_pass http://10.1.1.48:8081?v=456&feature=True;
}
}
PS: ドメインとパスは、それぞれ www.test.com と (abc|def) に限定されません。
ありがとう!