首页 > 解决方案 > 如何通过 NGINX 中的标头值创建 proxy_pass 联结?

问题描述

我想做这样的事情:

location / {

    if($http_x_my_header == 'some-value') {
        proxy_pass "https://a/";
    }
    # else
    proxy_pass "https://b/";

}

因为我知道在 NGINX 中使用“IF”可能会有问题:我将如何解决以下“最佳实践”?

标签: if-statementnginxheaderlocationopenresty

解决方案


推荐阅读