我正在尝试让proxy_pass使用自定义变量
location / {
set $proxy_pass_dest destination;
proxy_pass http://$proxy_pass_dest;
}
并且它不起作用。但是:
location / {
proxy_pass http://destination;
}
效果很好。我该怎么办?
我发现的最佳解决方案根本不使用任何变量。为proxy_pass使用变量需要完整的域名。这是我的解决方案:
if ($arg_somearg) {
proxy_pass http://destination;
}
if ($arg_otherarg) {
proxy_pass http://destination;
}
proxy_pass http://destination2;