I'm facing an issue where Chrome keeps redirecting my local development server (running a Django backend) to HTTPS despite it only supporting HTTP. I'm getting a code 400 error with the message 'Bad request version'. It works on other browsers, though. I've tried changing ports, but that doesn't solve the problem. Stockoverflow suggests deleting history and cache, but I'd prefer a proper fix. This issue might have started after I added certain settings related to CORS and security headers in my Django settings, and even reverting those changes hasn't resolved the issue. Can anyone help me with a more lasting solution?
1 Answer
Check what top-level domain (TLD) you're using. Chrome has been pushing for HTTPS, so if your server responds to HTTPS requests, it might trigger a redirect. If you’re using something like '.dev', it has strict HSTS policies that force HTTPS. Instead, try using '.test' or '.localhost' as those don’t have such policies. If you need a real DNS, consider using another domain without HSTS policies.
I usually just work with localhost on Django's default port, but this issue started because I set a few security options to True by mistake. I cleared my cache and updated those settings, and now it's working fine again. But I appreciate your advice for the future!