HTTP 444(无响应)而不是404、403错误页面?

编程入门 行业动态 更新时间:2024-10-23 22:31:21
本文介绍了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错误页面?

本文发布于:2023-10-31 15:41:21,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1546535.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:而不是   错误   页面   HTTP

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!