location /statement { proxy_set_header Host $host; proxy_set_header X-Forwarded-Host $host; proxy_set_header X-Forwarded-Server $host; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; proxy_http_version 1.1; proxy_set_header Connection ""; # Redirect to https if the protocol is http and the cookie is set set $send_to_https 1; if ($cookie_bcp_active__my_account != "Y") { set $send_to_https 0; } if ($scheme = "https") { set $send_to_https 0; } if ($send_to_https) { rewrite ^ https://$http_host$request_uri? redirect; } proxy_pass http://$upstream_live_bcp_active__my_account; }