location / { if ($scheme = http) { rewrite ^ https://$server_name$request_uri? permanent; } proxy_pass http://localhost:9001/; proxy_set_header Host $host; # be carefull, this line doesn't override any proxy_buffering on set in a conf.d/file.conf proxy_buffering off; }