What's the rationale behind the online ban on empty headers in Apache?
天蓬老师
天蓬老师 2017-05-16 16:59:57
0
2
775

Today my server was maliciously parsed by a domain name. I checked and found that it was redirected by 301. I checked online and found that closing the empty host header can be used to prevent malicious domain name parsing. Add the following to httpd-vhost.conf Code

NameVirtualHost *
<VirtualHost *:80>
DocumentRoot "E:/error"
ServerName abc.com
</VirtualHost>

This method did solve my problem, but I don’t quite understand the principle here....

天蓬老师
天蓬老师

欢迎选择我的课程,让我们一起见证您的进步~~

reply all(2)
滿天的星座

I know nginx is set up like this, and the principle of Apache should be similar:

server
{
    listen 80 default; 
    server_name _; 
    return 444; 
} 

If nginx does not find the matching domain name in server{} and it is maliciously parsed, _这个默认的server_name,直接返回444自定义状态码,也就是主动关闭请求。也可以使用499 will be used. This is another custom status code of nginx, which means that the client cannot wait for the server to respond and actively closes the connection.

左手右手慢动作

Just add a virtual host and respond to all access to abc.com with the contents of the E:/error folder.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template