自从几天前我在服务器上放了一个新的 javascript 文件以来,我一直收到奇怪的 404 日志。似乎某些 Java 用户代理与 jQuery (1.6.2) 的某些部分发生冲突。每当有人遇到 404 时,我都会发送一封自动电子邮件,并发送服务器变量。
http_user_agentJava/1.4.1_04
和 request_uri 如下:
/frontend/js/,data:c,complete:function(a,b,c){c=a.responseText,a.isResolved()&&(a.done(function(a){c=a}),i.html(g?f(
紧接着:
/frontend/js/]};bf.optgroup=bf.option,bf.tbody=bf.tfoot=bf.colgroup=bf.caption=bf.thead,bf.th=bf.td,f.support.htmlSerialize||(bf._default=[1,
javascript 的两个部分都可以在jQuery 的精简源代码。这/frontend/js/
是我的 javascript 文件的路径。
我刚刚在 StackOverflow 上读到两个类似的问题(1和2),但都没有任何解决方案。我也会在那里发表评论,但我想知道这里是否可能有更多人遇到同样的问题并解决了它。
有人知道吗?
答案1
用户代理与此无关,当然也不会造成问题 - 错误的 URL 应该得到 404,这些请求就是这样。这是一些编写糟糕的机器人由于重大解析失败而请求了荒谬的无效路径(注意到无效部分都以"
字符开始和结束?)。
花点时间嘲笑一下那个在其机器人的 js 解析器上失败得如此惨烈的可怜傻瓜,然后继续忽略 404 并继续你的一天(或者如果必须的话阻止该用户代理)。
答案2
查看我自己的服务器日志,我发现有多个这样的条目,分布在几个星期内,来自几个不同的 IP 地址。所有条目都具有相似(但略有不同)的用户代理。
大多数(但不是全部) IP 地址似乎位于罗马尼亚。
以下是我的日志样本:
[02/Aug/2011:23:20:32 +0000] "GET /assets/js/,data:c,complete:function(a,b,c)%7bc=a.responseText,a.isResolved()&&(a.done(function(a)%7bc=a%7d),i.html(g?f( HTTP/1.1" 200 203 "-" "Java/1.6.0_04"
[03/Aug/2011:05:06:30 +0000] "GET /assets/js/,data:c,complete:function(a,b,c){c=a.responseText,a.isResolved()&&(a.done(function(a){c=a}),i.html(g?f( HTTP/1.1" 200 203 "-" "Java/1.6.0_04"
[04/Aug/2011:12:03:35 +0000] "GET /assets/js/,data:c,complete:function(a,b,c)%7bc=a.responseText,a.isResolved()&&(a.done(function(a)%7bc=a%7d),i.html(g?f( HTTP/1.1" 200 203 "-" "Java/1.6.0_11"
[06/Aug/2011:15:34:00 +0000] "GET /assets/js/,data:c,complete:function(a,b,c)%7bc=a.responseText,a.isResolved()&&(a.done(function(a)%7bc=a%7d),i.html(g?f( HTTP/1.1" 200 203 "-" "Java/1.6.0_22"
[06/Aug/2011:18:20:46 +0000] "GET /assets/js/,data:c,complete:function(a,b,c){c=a.responseText,a.isResolved()&&(a.done(function(a){c=a}),i.html(g?f( HTTP/1.1" 200 203 "-" "Java/1.6.0_22"
[06/Aug/2011:19:40:11 +0000] "GET /assets/js/,data:c,complete:function(a,b,c)%7bc=a.responseText,a.isResolved()&&(a.done(function(a)%7bc=a%7d),i.html(g?f( HTTP/1.1" 200 203 "-" "Java/1.6.0_25"
[07/Aug/2011:07:55:24 +0000] "GET /assets/js/,data:c,complete:function(a,b,c)%7bc=a.responseText,a.isResolved()&&(a.done(function(a)%7bc=a%7d),i.html(g?f( HTTP/1.1" 200 203 "-" "Java/1.6.0_20"
[10/Aug/2011:09:07:47 +0000] "GET /assets/js/,data:c,complete:function(a,b,c){c=a.responseText,a.isResolved()&&(a.done(function(a){c=a}),i.html(g?f( HTTP/1.1" 200 203 "-" "Java/1.6.0_22"
[14/Aug/2011:14:53:58 +0000] "GET /assets/js/,data:c,complete:function(a,b,c)%7bc=a.responseText,a.isResolved()&&(a.done(function(a)%7bc=a%7d),i.html(g?f( HTTP/1.1" 200 203 "-" "Java/1.6.0_04"
[16/Aug/2011:21:04:50 +0000] "GET /assets/js/,data:c,complete:function(a,b,c)%7bc=a.responseText,a.isResolved()&&(a.done(function(a)%7bc=a%7d),i.html(g?f( HTTP/1.1" 200 203 "-" "Java/1.6.0_04"
[17/Aug/2011:09:19:12 +0000] "GET /assets/js/,data:c,complete:function(a,b,c){c=a.responseText,a.isResolved()&&(a.done(function(a){c=a}),i.html(g?f( HTTP/1.1" 200 203 "-" "Java/1.6.0_04"
[22/Aug/2011:01:50:44 +0000] "GET /assets/js/,data:c,complete:function(a,b,c)%7bc=a.responseText,a.isResolved()&&(a.done(function(a)%7bc=a%7d),i.html(g?f( HTTP/1.1" 200 203 "-" "Java/1.6.0_26"
[22/Aug/2011:19:13:00 +0000] "GET /assets/js/,data:c,complete:function(a,b,c)%7bc=a.responseText,a.isResolved()&&(a.done(function(a)%7bc=a%7d),i.html(g?f( HTTP/1.1" 200 203 "-" "Java/1.6.0_04"
[26/Aug/2011:18:15:06 +0000] "GET /assets/js/,data:c,complete:function(a,b,c)%7bc=a.responseText,a.isResolved()&&(a.done(function(a)%7bc=a%7d),i.html(g?f( HTTP/1.1" 200 203 "-" "Java/1.6.0_04"
[08/Sep/2011:00:00:01 +0000] "GET /assets/js/,data:c,complete:function(a,b,c){c=a.responseText,a.isResolved()&&(a.done(function(a){c=a}),i.html(g?f( HTTP/1.1" 200 203 "-" "Java/1.6.0_04"
[10/Sep/2011:16:09:39 +0000] "GET /assets/js/,data:c,complete:function(a,b,c){c=a.responseText,a.isResolved()&&(a.done(function(a){c=a}),i.html(g?f( HTTP/1.1" 200 203 "-" "Java/1.6.0_04"
[12/Sep/2011:14:50:15 +0000] "GET /assets/js/,data:c,complete:function(a,b,c)%7bc=a.responseText,a.isResolved()&&(a.done(function(a)%7bc=a%7d),i.html(g?f( HTTP/1.1" 200 203 "-" "Java/1.6.0_04"
[13/Sep/2011:14:25:08 +0000] "GET /assets/js/,data:c,complete:function(a,b,c){c=a.responseText,a.isResolved()&&(a.done(function(a){c=a}),i.html(g?f( HTTP/1.1" 200 203 "-" "Java/1.6.0_04"
[13/Sep/2011:16:14:05 +0000] "GET /assets/js/,data:c,complete:function(a,b,c){c=a.responseText,a.isResolved()&&(a.done(function(a){c=a}),i.html(g?f( HTTP/1.1" 200 203 "-" "Java/1.6.0_04"
虽然我不相信这个误导性的机器人会造成任何伤害,但我将遵循这个博客并阻止所有来自 Java 用户代理的点击。作为预防措施,您可能希望执行相同的操作。