1

I have enabled the setting:

USE_X_FORWARDED_HOST = True

in my settings.py. I am currently deploying the server, but when I try to render my index page it gives me a 404. The email says that it is a:

Invalid HTTP_HOST header: u'127.0.0.1:9001

And BEFORE ANYONE SAYS THAT I NEED TO ADD IT TO MY ALLOWED_HOSTS, I already have, so please spare me with from that advice. I also received an email with the debug error. When I looked through the debug info, it had a list of my settings and it stated that:

USE_X_FORWARDED_HOST = False

Another field that is not being updated is my ALLOWED_HOSTS. I tried restarting apache2, touching wsgi.py, and deleting *.pyc in the main app directory that contains settings.pyc. However, none of this has worked.

Some background on my deployment. I have my django behind a proxy because I am using django channels with an apache2 webserver serving as the proxy. I also have daphne running behind it which receives the requests and services them.

swrap
  • 314
  • 1
  • 3
  • 11
  • Is it working when you run from Django Server (runserver 0.0.0.0)? – Zulfugar Ismayilzadeh Sep 20 '16 at 21:44
  • umm this is no longer in development, this is a deployed django server. So I am not using "runserver". But no 0.0.0.0 does not fix my problem of the settings.py being incorrect. – swrap Sep 20 '16 at 23:59

1 Answers1

2

Solved the problem. The redis server had to be restarted everytime the settings.py was updated for some reason.

swrap
  • 314
  • 1
  • 3
  • 11