if ($host ~* "^(.*.v(iewer)?)." ) {
  set  $production_host  $1.yandex-team.ru;
}

include includes/auth-request;

proxy_next_upstream timeout http_500 http_502 error;

proxy_set_header Host $production_host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Authorization "";
proxy_set_header X-Yandex-Login $YandexTeamLogin;
proxy_set_header X-Forwarded-User $YandexTeamLogin;
