1
votes

I setup a vagrant VM with django installed, and setup the port forwarding like this:

  config.vm.network "forwarded_port", guest: 8000, host: 8001

So in the guest machine I run the django server like this:

python manage.py 0.0.0.0:8000

And the server starts up and tells me its running on http://127.0.0.1:8000 When I open up firefox on the host machine and point it to http://127.0.0.1:8001, it automatically redirects to https://127.0.0.1:8001 and I get this error:

An error occurred during a connection to 127.0.0.1:8001. SSL received a record that exceeded the maximum permissible length. Error code: SSL_ERROR_RX_RECORD_TOO_LONG

Nowhere in the settings.py file does it force https. I don't know whats causing it to redirect to https, or how I can go about figuring that out. Is this a problem with virtualbox, vagrant or django?

These error messages appear in the terminal where I run the server:

[06/Jan/2017 05:17:22] code 400, message Bad request syntax ('\x16\x03\x01\x00¥\x01\x00\x00¡\x03\x03d')
You're accessing the development server over HTTPS, but it only supports HTTP.
[06/Jan/2017 05:17:31] code 400, message Bad HTTP/0.9 request type ("\x16\x03\x01\x00¥\x01\x00\x00¡\x03\x03É\x8aVY@¦Û2\x
9c'\x1a5n¬òðÿ𪪮pÛ%å\x15#8jÕQé\x00\x00")
You're accessing the development server over HTTPS, but it only supports HTTP.

So the question is why is my browser trying to access the server over HTTPS?

1

1 Answers

2
votes

You need to add this in your settings.py file :

 SECURE_SSL_REDIRECT = False

For further reading, Read from here.