0

I'm facing a Django DisallowedHost error, googling the solution lead me to add the domains in question to the ALLOWED_HOSTS list in settings.py.

However, doing so causes the connection to flat out refuse to connect, and seemingly force https.

DisallowedHost Error log:

https://pastebin.com/sEg73qmV

django.core.exceptions.DisallowedHost: Invalid HTTP_HOST header: 'www.davixxa.net'. You may need to add 'www.davixxa.net' to ALLOWED_HOSTS.

This being the specific error of interest.

Settings.py: https://pastebin.com/1Mz9xNSC

Any help would be greatly appreciated.

Davixxa
  • 441
  • 1
  • 4
  • 9

1 Answers1

0

You have missconfiguration

hostname in ALLOWED_HOSTS sorted accessing site from the following host but

considering you have been forced to https you should set to false SECURE_SSL_REDIRECT setting which enforces https

iklinac
  • 14,944
  • 4
  • 28
  • 30
  • I'm not quite getting what you're trying to say? Are you telling me to add the hosts to the list? I've gone ahead and done this, and that fetches me a simple [connection refused (screenshot)](https://i.imgur.com/wWSqqsy.png) error. – Davixxa Feb 11 '18 at 22:55
  • as you can see seems you have SECURE_SSL_REDIRECT set to true as HTTP request redirects you from http to https you should put following setting to false to remove following behaviour – iklinac Feb 11 '18 at 23:10
  • I've tried manually setting it to false in settings.py (it wasn't set before), and it seems to make no difference. – Davixxa Feb 11 '18 at 23:16
  • Alright. https redirect issue is fixed, used this solution: https://superuser.com/questions/565409/chrome-how-to-stop-redirect-from-http-to-https to fix that. Now I'm just left with Django not liking MySQL though. – Davixxa Feb 12 '18 at 11:14