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;
}
}