HTTP 444(无响应)而不是404、403错误页面? [英] HTTP 444 (No Response) instead of 404, 403 error pages?

查看:116
本文介绍了HTTP 444(无响应)而不是404、403错误页面?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我总是在nginx配置中使用"return 444"来阻止搜寻器直接通过IP或通过错误的主机名访问我的服务器.它只是关闭连接.完美.

I always use "return 444" in the nginx config to stop crawlers that access my servers directly via IP or via the wrong hostname. It just closes the connection. Perfect.

现在,我想使用此响应,而不是nginx抛出的标准404.html页面,但我无法进行配置.

Now i want to use this response instead of the standard 404.html pages that nginx throws but i fail at configuring.

    error_page 500 502 503 504 /custom_50x.html;

这很好,但是我不能像下面这样返回444":

This works fine, but i cant "return 444" like here:

    server {
    listen      80;
    server_name "";
    return      444;
}

有人知道将两者结合的方法吗?

Does anybody know a way to combine these two?

提前谢谢!

推荐答案

重定向请求即可轻松返回状态代码

Redirect request then you can return status code easily

server {
error_page 500 502 503 504 =444 @blackhole;

  location @blackhole {
    return 444;
  }
}

这篇关于HTTP 444(无响应)而不是404、403错误页面?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆