我在共享主机上使用 apache fcgi 运行 django。我已将其设置为报告 404 错误并通过电子邮件继续查看Not Found: /406.shtml
(我猜s
是因为它只是 https)。但是我已经在以下位置设置了错误文档.htaccess
:
ErrorDocument 406 /error/406.html
ErrorDocument
在为每个错误设置一个之前,我从 django 收到了一堆类似的 404 错误,但它仍然发生在 406 上。grep 406
通过 apache 错误日志,我看到偶尔出现 406(不是 404)错误406.shtml
,例如以下,但不如 django 给我发电子邮件的频率:
[Fri ...] [error] [client ...]
ModSecurity: Access denied with code 406 (phase 1).
Pattern match "Mozilla ... AhrefsBot ...)" at REQUEST_HEADERS:User-Agent.
[file "/usr/local/apache/conf/mod_sec/mod_sec.hg.conf"] [line "126"]
[id "900165"]
[msg "AhrefsBot BOT Request"]
[hostname "www.myhostname.com"]
[uri "/406.shtml"]
[unique_id "..."]
我什至不确定这是否是 apache 内部重定向406.shtml
并将其转发到 django 或者是否某些机器人试图406.shtml
直接查找。前者似乎表明ErrorDocument
. 后者并不是我真正的问题,但是要么我应该406.shtml
在 apache 日志中看到 404,要么什么都没有,因为 django 将处理 404?我怎样才能进一步追踪它?
我无法仅通过访问我的网站来重现该问题,但我想知道发生了什么。