'Redirect http url to https for django application served by Apache without virtualHost
I have a django application running on http://localhost:8081
I want to redirect it to https://localhost:8081
I have following in my settings.py:
SECURE_SSL_REDIRECT = True
SESSION_COOKIE_SECURE = True
CSRF_COOKIE_SECURE = True
httpd.conf file has been modified to:
WSGIScriptAlias / /path/to/django/application/wsgi.py
#WSGIPythonHome /python3.9
WSGIPythonPath /path/to/django/application:/python3.9/lib/python3.9/site-packages
<Directory /path/to/django/application>
<Files wsgi.py>
Require all granted
</Files>
</Directory>
When I am trying to execute my django application with command:
/python3.9/bin/python3 manage.py runserver 8081
it gives this error on webpage:
This site can’t provide a secure connection
localhost sent an invalid response.
ERR_SSL_PROTOCOL_ERROR
I have not configured virtual environment and have default python2.7.
Installed python3.9 at different location on machine to serve django.
Any thoughts what I'm missing to make it work.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
