Como usar SSL em qualquer lugar, exceto em um endpoint

Como usar SSL em qualquer lugar, exceto em um endpoint

Eu tenho um site onde desejo que todas as solicitações sejam feitas com HTTPS, exceto solicitações para URLs com caminhos que começam com/out/.

O nginx está configurado como proxy para servir conteúdo gunicorn/django dehttp://127.0.0.1:8000.

aqui está a configuração que tenho até agora, mas parece que ela não usa SSL em lugar nenhum.

server {

listen 80;
listen 443 default ssl;
server_name my.website.com;
ssl_certificate /etc/nginx/ssl/nginx.crt;
ssl_certificate_key /etc/nginx/ssl/nginx.key;

root /home/ubuntu/app;
client_max_body_size 1m;
access_log /home/ubuntu/app/logs/access.log;
error_log /home/ubuntu/app/logs/error.log;

location ~ ^/(out|out/.*)$ {
    proxy_set_header X-Forward-For $proxy_add_x_forwarded_for;
    proxy_set_header Host $http_host;
    proxy_redirect off;
    if (!-f $request_filename) {
        proxy_pass http://127.0.0.1:8000;
        break;
    }
}

location / {
    proxy_set_header X-Forward-For $proxy_add_x_forwarded_for;
    proxy_set_header Host $http_host;
    proxy_redirect off;
    if (!-f $request_filename) {
        proxy_pass http://127.0.0.1:8000;
        break;
    }
    if ($ssl_protocol = "") {
           rewrite  ^ https://$server_name$request_uri? permanent;
    }
}
}

informação relacionada