Skip to content

Instantly share code, notes, and snippets.

@linuxkathirvel
Last active July 27, 2023 10:16
Show Gist options
  • Save linuxkathirvel/803de405c8b26c9953b743871e7d6847 to your computer and use it in GitHub Desktop.
Save linuxkathirvel/803de405c8b26c9953b743871e7d6847 to your computer and use it in GitHub Desktop.
How to fix "You're accessing the development server over HTTPS, but it only supports HTTP." in Django?

How to fix "You're accessing the development server over HTTPS, but it only supports HTTP." in Django?

Check the Django's site URL. It may have https.

Disable following variables in settings.py or .env

SECURE_CONTENT_TYPE_NOSNIFF = True
SECURE_BROWSER_XSS_FILTER = True
SESSION_COOKIE_SECURE = True
CSRF_COOKIE_SECURE = True
SECURE_SSL_REDIRECT = True
SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')
CSRF_TRUSTED_ORIGINS = ['yoursite.com']

Set DEBUG as True

DEBUG = True

Clear the Django site's(what you developed) cookies and sessions on the browser. For Google Chrome, steps are below.

Settings-> Privacy and Security -> Cookies and other site data -> See all cookies and site data -> Search your site name or IP and click 'Trash' icon.

Close the browser and reload the site now.

@clebergriff
Copy link

Thank you very much @dgerok ! That helped me setting up on AWS EC2

@olawalejuwonm
Copy link

Still having this issue when setting up asgi

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment