Help with Gunicorn/Django deployment… I can’t force HTTPS! /u/Cabbage_Cannon Python Education

Hello!

I am locally hosting my django website to the greater web. It works totally fine with let’s encrypt ssl forced… But no matter what I do, I can’t seem to get an HTTPS connection . I can get an SSL certification when connecting, but when I force HTTPS it fails to connect. Any tips?

NGinx Proxy Manager Django==4.1.7 gunicorn==20.1.0 PiHole to manage Local DNS, not running on 80 or 443. DDNS configured in Router, using any.DDNS Porkbun 

Nginx Proxy Manager setup:

Running in a docker
Let’s Encrypt Certificates
Trying to switch between HTTP and HTTPS
Trying to swtich between force SSL and not

Most recently attempted “Advanced” config

location /static/ { alias /home/staticfiles/; } location ~ /.ht { deny all; } 

Gunicorn Setup:

Most recently attempted CLI run:

gunicorn --forwarded-allow-ips="127.0.0.1" AlexSite.wsgi:application --bind 0.0.0.0:XXXX (IP revoked for Reddit) 

Django Setup:

Debug: False

Most recently attempted HTTPS code setup in my settings.py

SECURE_SSL_REDIRECT = True SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https') CSRF_COOKIE_SECURE = True SESSION_COOKIE_SECURE = True 

submitted by /u/Cabbage_Cannon
[link] [comments]

​r/learnpython Hello! I am locally hosting my django website to the greater web. It works totally fine with let’s encrypt ssl forced… But no matter what I do, I can’t seem to get an HTTPS connection . I can get an SSL certification when connecting, but when I force HTTPS it fails to connect. Any tips? NGinx Proxy Manager Django==4.1.7 gunicorn==20.1.0 PiHole to manage Local DNS, not running on 80 or 443. DDNS configured in Router, using any.DDNS Porkbun Nginx Proxy Manager setup: Running in a docker Let’s Encrypt Certificates Trying to switch between HTTP and HTTPS Trying to swtich between force SSL and not Most recently attempted “Advanced” config location /static/ { alias /home/staticfiles/; } location ~ /.ht { deny all; } Gunicorn Setup: Most recently attempted CLI run: gunicorn –forwarded-allow-ips=”127.0.0.1″ AlexSite.wsgi:application –bind 0.0.0.0:XXXX (IP revoked for Reddit) Django Setup: Debug: False Most recently attempted HTTPS code setup in my settings.py SECURE_SSL_REDIRECT = True SECURE_PROXY_SSL_HEADER = (‘HTTP_X_FORWARDED_PROTO’, ‘https’) CSRF_COOKIE_SECURE = True SESSION_COOKIE_SECURE = True submitted by /u/Cabbage_Cannon [link] [comments] 

Hello!

I am locally hosting my django website to the greater web. It works totally fine with let’s encrypt ssl forced… But no matter what I do, I can’t seem to get an HTTPS connection . I can get an SSL certification when connecting, but when I force HTTPS it fails to connect. Any tips?

NGinx Proxy Manager Django==4.1.7 gunicorn==20.1.0 PiHole to manage Local DNS, not running on 80 or 443. DDNS configured in Router, using any.DDNS Porkbun 

Nginx Proxy Manager setup:

Running in a docker
Let’s Encrypt Certificates
Trying to switch between HTTP and HTTPS
Trying to swtich between force SSL and not

Most recently attempted “Advanced” config

location /static/ { alias /home/staticfiles/; } location ~ /.ht { deny all; } 

Gunicorn Setup:

Most recently attempted CLI run:

gunicorn --forwarded-allow-ips="127.0.0.1" AlexSite.wsgi:application --bind 0.0.0.0:XXXX (IP revoked for Reddit) 

Django Setup:

Debug: False

Most recently attempted HTTPS code setup in my settings.py

SECURE_SSL_REDIRECT = True SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https') CSRF_COOKIE_SECURE = True SESSION_COOKIE_SECURE = True 

submitted by /u/Cabbage_Cannon
[link] [comments] 

Leave a Reply

Your email address will not be published. Required fields are marked *