Using if statements in a location block with set

Is the following going to work as expected:

location /v1/users {
rewrite ^/users/(.*)/accounts$ /v1/users/$1/accounts
break;

    if ($server_name = 'js.mydomain.com') {
        set $backend  "api.mydomain.com";
    }

    if ($server_name = 'js-s.mydomain.com') {
        set $backend  "api-s.mydomain.com";
    }

    proxy_pass     https://$backend;
}

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,242643,242643#msg-242643

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs