Hi Jared, I don't think that's Federico's issue.
I have my ALLOWED_HOSTS set to the domain name(s) I allow, but quite often will get the error email with my site's IP address, which is not in ALLOWED_HOSTS (as I don't want people accessing the site using the IP). I suspect it's some malicious bot out there trying to run some sort of exploit on the site, and the error from Django is just an indication that this is happening. Prior to Django 1.6, I would get these errors as proper error reports with a full traceback, sent to me via Error stack (I have some handlers set up in my code for this). Usually the access was to admin.php or some other non-existent PHP file. However, since moving to Django 1.6/Mezzanine 3.x only the email errors come directly from Django - with a "repr() unavailable" message instead of a traceback, and the handlers set up in my settings.py are completely skipped. I'm not sure what changed so that this sort of error is not passed to my custom error handler, but it's not something that's easy to replicate for testing purposes, so I'm basically just ignoring the messages... Any pointers as to how to get these error messages sent with a proper traceback, or to be passed to my error handler (and thus to ErrorStack) would be greatly appreciated. All the best, Seeya. Danny. On 27 May 2014 07:53, Jared Nielsen <[email protected]> wrote: > Hi Federico, > If you're using NGINX you can add a rewrite to your sites .conf file. > > http://jarednielsen.com/blog/how-to-configure-server-name-redirect-in-nginx/ > I was receiving the same error (and an inbox full of Django notices) but > fixed it with the solution linked above. > Cheers. > > On Monday, May 26, 2014 5:34:23 AM UTC-6, Federico Bruni wrote: >> >> I've been getting this error message since I've deployed my mezzanine >> website: >> [Django] ERROR: Invalid HTTP_HOST header: 'domain.com'.You may need to >> add u'domain.com' to ALLOWED_HOSTS >> >> where domain.com is most of the times the IP of the server, few times a >> secondary domain which redirects to the main one and one time www.fbi.gov:-) >> >> I've read the pages below, so I think that I can just ignore the error >> (I'm sure that my ALLOWED_HOSTS is restrictive). >> I guess that I can wait for Django >= 1.7b4 in Mezzanine and then I won't >> get any error message. Right? >> >> http://stackoverflow.com/questions/15238506/djangos- >> suspiciousoperation-invalid-http-host-header >> https://code.djangoproject.com/ticket/19866 >> https://github.com/django/django/commit/d228c1192ed59ab0114d9eba82ac99 >> df611652d2 (added in django 1.7b4) >> >> -- > You received this message because you are subscribed to the Google Groups > "Mezzanine Users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > For more options, visit https://groups.google.com/d/optout. > -- [email protected] -- You received this message because you are subscribed to the Google Groups "Mezzanine Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
