nginx if / condition on an environment variable

Viewed 289

Have a need for environment variable condition in nginx server config. The location directive by itself works but getting invalid condition for any test on the environment variable.

# Proxy files to live site
if ($LIVE_DOMAIN != '') {
    location ~ ^/sites/default/files/(.*)$ {
        proxy_pass https://$LIVE_DOMAIN/sites/default/files/$1;
    }
}
0 Answers
Related