# https://st.yandex-team.ru/TVFRONT-3456
# https://st.yandex-team.ru/TVFRONT-4533

proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Request-Id $request_id;
proxy_set_header Host $proxy_qloud_host;
proxy_set_header X-Upstream-Host $host;
proxy_set_header X-NginX-Proxy true;

location ~ ^/api/* {
    proxy_pass https://react_tv_front$request_uri;
    proxy_intercept_errors on;
    proxy_redirect off;
}

location ~ ^/(\d+)?$ {
    proxy_pass https://react_tv_front$request_uri;
    proxy_intercept_errors on;
    proxy_redirect off;
}

location ~ ^/(\d+/)?channels/ {
    proxy_pass https://react_tv_front$request_uri;
    proxy_intercept_errors on;
    proxy_redirect off;
}

location ~ ^/(\d+/)?program/ {
    proxy_pass https://react_tv_front$request_uri;
    proxy_intercept_errors on;
    proxy_redirect off;
}

location ~ ^/(\d+/)?search {
    proxy_pass https://react_tv_front$request_uri;
    proxy_intercept_errors on;
    proxy_redirect off;
}

location ~ ^/(\d+/)?lists/ {
    proxy_pass https://react_tv_front$request_uri;
    proxy_intercept_errors on;
    proxy_redirect off;
}

location ~ ^/(\d+/)?my/favorites {
    proxy_pass https://react_tv_front$request_uri;
    proxy_intercept_errors on;
    proxy_redirect off;
}

location ~ ^/special/ {
    proxy_pass https://react_tv_front$request_uri;
    proxy_intercept_errors on;
    proxy_redirect off;
}

location ~ ^/(\d+/)?sport/ {
    proxy_pass https://react_tv_front$request_uri;
    proxy_intercept_errors on;
    proxy_redirect off;
}

location ~ /social\-closer\.html$ {
    proxy_pass https://react_tv_front$request_uri;

    proxy_intercept_errors on;
    proxy_redirect off;
}

location ~ ^/manifest\.json$ {
    proxy_pass https://react_tv_front$request_uri;
    proxy_intercept_errors on;
    proxy_redirect off;
}

location ~ ^/service\-worker\.js$ {
    proxy_pass https://react_tv_front$request_uri;
    proxy_intercept_errors on;
    proxy_redirect off;
}

location ~ ^/launcher\-icon(.+\.(?:jpe?g|png)) {
    proxy_pass https://react_tv_front$request_uri;
    proxy_intercept_errors on;
    proxy_redirect off;
}
