依旧是朋友问到,然后给他解答。大体上就是发给我一个类似如下的配置:

location / {
    set $hello "https://www.baidu.com";
    if ($cookie_pass = "7") {
        set $hello "https://www.google.com";
    }
    proxy_pass $hello;
}

配置测试没错,但实际访问报如下错误:

The page you are looking for is temporarily unavailable. Please try again later.

大致看了一下,dns解析出现了问题,在配置里添加resolver就可以动态解析了。修改后的配置如下:

location / {
    resolver 114.114.114.114;
    set $hello "https://www.baidu.com";
    if ($cookie_pass = "7") {
        set $hello "https://www.google.com";
    }
    proxy_pass $hello;
}

dns server(144.144.144.144)可以根据自己需求修改。
问题解决,继续喝茶。