Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error "You're accessing the development server over HTTPS, but it only supports HTTP"

SSL connection

When I try to write the server link like http:// .... it redirects to https:// and in 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. 
like image 223
A.Raouf Avatar asked Feb 21 '16 13:02

A.Raouf


1 Answers

I think you should create different 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 hostname of your PC.

P:S: I'm using Windows 10.

After doing that place the below data in your production_settings.py and save. Then clear your browser cache and visit your site in development server.

SESSION_COOKIE_SECURE = True CSRF_COOKIE_SECURE = True SECURE_SSL_REDIRECT = True 

If the above doesn't suit your needs, then in your local_settings.py paste the below data, save and clear your browser cache and visit your site.

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 base settings should contain 'settings' that will be used both on local and production server so you won't be repeating it everytime.

P:S If my answer is accepted, I dedicate it to the good people on SO who have helped me in one way or the other. This is my first time of answering a question. I hope to do more in the future. :)

like image 111
smack Avatar answered Oct 03 '22 13:10

smack