Error "You are accessing the development server via HTTPS, but it only supports HTTP"

SSL connection

When I try to write a server link, for example http: // ...., it redirects to https: // and to the terminal:

message Bad HTTP/0.9 request type ('\x16\x03\x01\x00\x8b\x01\x00\x00\x87\x03\x01Ð\x118¿JÄ\x19[Òç\x01<O') You're accessing the development server over HTTPS, but it only supports HTTP. 
+8
django ssl
source share
2 answers

I think you need to create various settings.py (base_settings.py, local_settings.py, production_settings.py). And in your settings.py do something like this:

 import socket if socket.gethostname()=="Raouf-PC": from local_settings import * 

Change "Raouf-PC" to the host name of your PC.

P: S: I am using Windows 10.

After that, place the data below in the file production_settings.py and save. Then clear your browser’s cache and go to your site on the development server.

 SESSION_COOKIE_SECURE = True CSRF_COOKIE_SECURE = True SECURE_SSL_REDIRECT = True 

If the above does not meet your needs, then in your local_settings.py file, paste the data below, save and clear your browser’s cache and go to your website.

 SESSION_COOKIE_SECURE = False CSRF_COOKIE_SECURE = False SECURE_SSL_REDIRECT = False 

Note: at the beginning of production_setttings.py and local_settings.py put:

 from base_settings.py import * 

Your basic settings should contain "settings" that will be used on both the local and production server so that you do not repeat it every time.

P: S If my answer is accepted, I will devote it to the good people who helped me anyway. This is my first answer to the question. I hope to do more in the future. :)

+16
source

You probably have the SECURE_SSL_REDIRECT parameter set to True

This parameter must be False when starting the development server.

+6
source

All Articles