I have an error during the session, code 400, message Bad request version ('׫')

Question:

Let’s me explain that. Few days ago I installed a django app with docker, I had no problem with that, and later I tried to add a security for settings.py and now I have an error

code 400, message Bad request version ('׫') 
You're accessing the development server over HTTPS, but it only supports HTTP.

and now when I start creating new app I have a same error but I did not add security for new app

So my files

db.sqlite3 manage.py requirements.txt  src  venv

I am using django 4.0 with psycopg 2.9.3

Next, when I am going to run a server

python manage.py runserver 

I have seen that

Watching for file changes with StatReloader
Performing system checks...

System check identified no issues (0 silenced).

You have 18 unapplied migration(s). Your project may not work properly until you 
apply the migrations for app(s): admin, auth, contenttypes, sessions.
Run 'python manage.py migrate' to apply them.
March 27, 2023 - 09:17:44
Django version 4.0, using settings 'src.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CONTROL-C.

When I log in to the server http://127.0.0.1:8000/

I see on browser this https://localhost:8000/

and a same error code 400

Shoud i delete a docker?

Thanks a lot!

Asked By: Atabekdemurtaza

||

Answers:

Looks like you are accessing https://localhost:8000/ while you should be accessing http://localhost:8000/. Note: it should be http and not https.


Also, if the security features you added are https related, then maybe you have problems with the settings.

To fix the HTTPS error, you should check your settings.py file and make sure that the SECURE_SSL_REDIRECT setting is set to False. Also, make sure that your Docker container is set up to use HTTP on port 8000.

If the error keeps happening, you might want to rebuild your Docker container with the correct settings.

Answered By: Timmy Chan

In settings.py try changing

ACCOUNT_DEFAULT_HTTP_PROTOCOL = "https"

to

ACCOUNT_DEFAULT_HTTP_PROTOCOL = "http"

Or Try running through different port eg. python manage.py runserver 2000

Answered By: Jayappratha
Categories: questions Tags: , , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.