Hello Jon,
the documentation describes how to silence this error at https://docs.djangoproject.com/en/2.0/topics/logging/#django-security.
How have you deployed your Django project? I always configure Apache or nginx in such a way so that such invalid requests never reach Django.
Regards,
Antonis
Antonis Christofides http://djangodeployment.com
I'm getting spammed with constant "Invalid HTTP_HOST header: '10.9.8.7:443'. You may need to add '10.9.8.7' to ALLOWED_HOSTS" emails, due to the Internet being the Internet. How can I disable these emails, without turning off error emails completely? I don't particularly want to add the IP address to the ALLOWED_HOSTS. It seems to me this email shouldn't be being generated if the HTTP_HOST value is an IP literal.
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/0f07d6ca-626c-4887-86e5-a5d10190bc49%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
the documentation describes how to silence this error at https://docs.djangoproject.com/en/2.0/topics/logging/#django-security.
How have you deployed your Django project? I always configure Apache or nginx in such a way so that such invalid requests never reach Django.
I may be wrong of course, but I don't recall SNI having anything
to do with it. Just using something like
server { listen 80; listen 443 ssl; server_name my.django.site.com; ... }will only send requests for my.django.site.com to the django project. I really don't know about SNI, but I recall having used SSL on Apache before SNI existed and I don't remember any difference with respect to that. Why does SNI affect this?
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/11A18532-A2F4-4F02-AA24-9B6AD9C90DE2%40gmail.com.
I may be wrong of course, but I don't recall SNI having anything to do with it. Just using something like
server { listen 80; listen 443 ssl; server_name my.django.site.com; ... }will only send requests for my.django.site.com to the django project. I really don't know about SNI, but I recall having used SSL on Apache before SNI existed and I don't remember any difference with respect to that. Why does SNI affect this?
server {
listen 80;
listen 443 ssl;
server_name my.django.site.com
;
ssl_certificate /path/to/my.django.site.com.cert;
ssl_certificate_key /path/to/my.django.site.com.key;... # serve the request with your Django app}
server {
listen 80 default_server;
listen 443 default_server ssl;
server_name _;
ssl_certificate /path/to/my.django.site.com.cert;
ssl_certificate_key /path/to/my.django.site.com.key;return 444; # reject the request}
This should ensure that only requests with valid Host headers reach your application while still supporting Non-SNI clients. You can test it with "open_ssl client" or "gnutls-cli":
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/88236646-9f3c-4984-a6d6-970d024b235b%40googlegroups.com.
So nginx chooses the "server {}" block that contains "default_server" to choose the SSL certificate, and after it receives the headers it choose another "server {}" block as needed? If that is the case, you can create another "server {}" block with "default_server" (usually this is somewhere like /etc/nginx/sites-available/default) that shall contain the certificate and always return 404.
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/bf3e62f2-2584-4a28-8680-5cb83dd88753%40googlegroups.com.