Nginx/Django Admin POST https only <p>I've got an Nginx/Gunicorn/Django server deployed on a Centos 6 machine with only the SSL port (443) visible to the outside world. So unless the server is called with the <code>https://</code>, you won't get any response. If you call it with an <code>http://domain:443</code>, you'll merely get a 400 Bad Request message. Port 443 is the only way to hit the server.</p> <p>I'm using Nginx to serve my static files (CSS, etc.) and all other requests are handled by Gunicorn, which is running Django at <code>http://localhost:8000</code>. So, navigating to <code>https://domain.com</code> works just fine, as do links within the admin site, but when I submit a form in the Django admin, the https is lost on the redirect and I'm sent to <code>http://domain.com/</code>request_uri which fails to reach the server. The POST action does work properly even so and the database is updated.</p> <p>My configuration file is listed below. The location <code>location /</code> section is where I feel like the solution should be found. But it doesn't seem like the <code>proxy_set_header X-*</code> directives have any effect. Am I missing a module or something? I'm running nginx/1.0.15. </p> <p>Everything I can find on the internet points to the <code>X-Forwarded-Protocol https</code> like it should do something, but I get no change. I'm also unable to get the debugging working on the remote server, though my next step may have to be compiling locally with debugging enabled to get some more clues. The last resort is to expose port 80 and redirect everything...but that requires some paperwork.</p> <p>[http://pastebin.com/Rcg3p6vQ](My nginx configure arguments)</p> <pre><code>server { listen 443 ssl; ssl on; ssl_certificate /path/to/cert.crt; ssl_certificate_key /path/to/key.key; ssl_protocols SSLv3 TLSv1 TLSv1.1 TLSv1.2; ssl_ciphers HIGH:!aNULL:!MD5; server_name example.com; root /home/gunicorn/project/app; access_log /home/gunicorn/logs/access.log; error_log /home/gunicorn/logs/error.log debug; location /static/ { autoindex on; root /home/gunicorn; } location / { proxy_pass http://localhost:8000/; proxy_redirect off; proxy_set_header Host $host; proxy_set_header X-Scheme $scheme; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Protocol https; } } </code></pre>