FastCGI application behind NGINX is unable to detect that HTTPS secure connection is used
Thanks to Yuji for the answer. I've updated my server block to conditionally inject HTTPS on or HTTPS off, depending on $server_port:
{
server { listen 80; listen 443 default ssl; if ($server_port = 443) { set $https on; } if ($server_port = 80) { set $https off; } ssl_certificate /home/webapp/ssl.crt ssl_certificate_key /home/webapp/ssl.key server_name myapp.com; access_log /home/webapp/access.log error_log /home/webapp/error.log root /home/mywebapp; location / { # host and port to fastcgi server fastcgi_pass 127.0.0.1:8801; fastcgi_param PATH_INFO $fastcgi_script_name; fastcgi_param REQUEST_METHOD $request_method; fastcgi_param QUERY_STRING $query_string; fastcgi_param SERVER_NAME $server_name; fastcgi_param SERVER_PORT $server_port; fastcgi_param SERVER_PROTOCOL $server_protocol; fastcgi_param CONTENT_TYPE $content_type; fastcgi_param CONTENT_LENGTH $content_length; fastcgi_pass_header Authorization; fastcgi_intercept_errors off; fastcgi_param HTTPS $https; }}
}