proxy_intercept_errors on;
recursive_error_pages on;
include includes/500-rasp;

access_log  /var/log/nginx/access.log  request_id_format;

# Вычисляем real_host и real_ip в зависимости от заголовков
set $real_host $host;
if ($http_x_rasp_real_host) {
    set $real_host $http_x_rasp_real_host;
}

set $real_ip $http_x_real_ip;
if ($http_x_rasp_real_ip) {
    set $real_ip $http_x_rasp_real_ip;
}

# Обработка статических 301-х редиректов
if ($redirect_uri_301) {
    return 301 https://$real_host$redirect_uri_301;
}

set $old_stack 0;

add_header X-Frame-Options $rasp_x_frame_options always;
add_header X-Content-Type-Options nosniff always;
add_header Strict-Transport-Security "max-age=31536000" always;
