我正在尝试使用HTTPS与Django管理站点。我正在使用SSLIfy管理中间件,并将以下代码添加到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"
当我尝试打开网站时。我遇到下面的错误 -
https://(LocalH 8000)/ admin /的网页可能暂时关闭,或者可能已永久移动到新的网址。 错误代码:ERR_CONNECTION_CLOSED
我不确定哪里出错了。我正在使用Apache并安装了Apache设置的SSL。 (How do I allow HTTPS for Apache on localhost?)
有人可以帮忙吗?提前致谢。