Django Invalid HTTP_HOST header
May 27, 2015
After upgrading to Django 1.7, I was getting error emails similar to the following:
Invalid HTTP_HOST header: 'XXX.XXX.XXX.XXX'. You may need to add u'XXX.XXX.XXX.XXX' to ALLOWED_HOSTS.
Request repr():
<WSGIRequest
path:/login.action,
GET:<QueryDict: {}>,
POST:<QueryDict: {u'redirect:${#res=#context.get(\'com.opensymphony.xwork2.dispatcher.HttpServletResponse\'),#res.setCharacterEncoding("UTF-8"),#req=#context.get(\'com.opensymphony.xwork2.dispatcher.HttpServletRequest\'),#res.getWriter().print("dir:"),#res.getWriter().println(#req.getSession().getServletContext().getRealPath("/")),#res.getWriter().flush(),#res.getWriter().close()}': [u'']}>,
COOKIES:{},
META:{'CONTENT_LENGTH': '395',
'CONTENT_TYPE': 'application/x-www-form-urlencoded',
'HTTP_ACCEPT': '*/*',
'HTTP_CONNECTION': 'close',
'HTTP_HOST': 'XXX.XXX.XXX.XXX',
'HTTP_USER_AGENT': 'Mozilla/5.0',
'HTTP_X_FORWARDED_FOR': '61.160.247.65', …

