3

I am trying to use HTTPS with Django Admin site. I am using SSLIfy Admin Middleware, and added the following piece of code to settings.py --

MIDDLEWARE_CLASSES = ('sslifyadmin.middleware.SSLifyAdminMiddleware',..... )

SSLIFY_DISABLE = True
SSLIFY_ADMIN_DISABLE = True

SESSION_COOKIE_SECURE = True  #true means browsers may ensure that the cookie is only sent under an HTTPS conn
CSRF_COOKIE_SECURE = True
SESSION_COOKIE_HTTPONLY = True

SECURE_SSL_REDIRECT = True
SECURE_HSTS_SECONDS = 2592000
SECURE_HSTS_INCLUDE_SUBDOMAINS = True
SECURE_FRAME_DENY = True
SECURE_CONTENT_TYPE_NOSNIFF = True
SECURE_BROWSER_XSS_FILTER = True
SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')
SSLIFY_ADMIN_NAMESPACE = "admin"

When I try to open the site. I run into the error below -

The webpage at https://( LocalH 8000)/admin/ might be temporarily down or it may have moved permanently to a new web address. Error code: ERR_CONNECTION_CLOSED

I am unsure where it's going wrong. I am using it with Apache and have installed SSL that came with the Apache set up. (How do I allow HTTPS for Apache on localhost?)

Can someone help? Thanks in advance.

Community
  • 1
  • 1
g_midwest
  • 31
  • 2

0 Answers0