From bc512cc0565451b4d8e2c6ef893598dd29c29c11 Mon Sep 17 00:00:00 2001 From: Bryan Date: Fri, 7 Feb 2014 19:08:16 -0500 Subject: [PATCH] updating nginx for SSL-only operation. closes #319 --- README.md | 16 ++++++++-------- Vagrantfile | 16 ++++++++-------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index f02354f..c631795 100644 --- a/README.md +++ b/README.md @@ -310,7 +310,13 @@ not generally be needed. server { listen 80; - listen 443 ssl; + server_name localhost; + return 301 https://$host$request_uri + } + + server { + listen 443; + ssl on; server_name localhost; client_max_body_size 20M; @@ -318,13 +324,7 @@ not generally be needed. # pass traffic through to gunicorn proxy_pass http://127.0.0.1:8000; # pass HTTP(S) status through to Django - if ($scheme ~ http) { - set $ssl 'off'; - } - if ($scheme ~ https) { - set $ssl 'on'; - } - proxy_set_header X-Forwarded-SSL $ssl; + proxy_set_header X-Forwarded-SSL $https; proxy_set_header X-Forwarded-Protocol $scheme; proxy_set_header X-Forwarded-Proto $scheme; # pass nginx site back to Django diff --git a/Vagrantfile b/Vagrantfile index 07725ed..c5089d7 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -106,7 +106,13 @@ chown vagrant:vagrant karmaworld/$SECRETPATH/*.py cat > /etc/nginx/sites-available/karmaworld <