I have a server that is using Nginx's 444 to drop connections to undefined hosts:
server {
listen 80;
server_name "";
return 444;
}
But I can't figure out how to test if it's working.
Here are a few things I've tried, stabbing in the dark:
$ curl -I mysite.com --header 'Host: ""'
HTTP/1.1 301 Moved Permanently
$ curl -I mysite.com --header ''
HTTP/1.1 301 Moved Permanently
I'm trying to get that 444!
Here's the relevant portion of my nginx mysite.conf file
server {
listen 80;
server_name "";
return 444;
}
server {
listen 80 default_server;
listen [::]:80 default_server;
server_name _;
return 301 https://$host$request_uri;
}
So either I'm testing it wrong, or I'm testing it correctly but the missing host header is still getting captured by my second server block and redirecting.
This works with curl 7.47:
curl -I --header Host: mysite.comNote that the argument to the header option is just
Host:('Host: 'and'Host: ""'won't work)Latest versions of curl may have a
--http0.9option that may get you the same result, but I didn't test it.