Javascript Apache错误:文件名太长:无法映射获取
我们最近开始在apache日志中看到一个新错误:Javascript Apache错误:文件名太长:无法映射获取,javascript,apache,Javascript,Apache,我们最近开始在apache日志中看到一个新错误: [Wed Mar 16 08:32:59 2011] [error] [client 10.40.1.2] (36)File name too long: Cannot map GET /static/app/js <..lots of javascript...> [Wed Mar 16 08:32:59 2011][error][client 10.40.1.2](36)文件名太长:无法映射GET/static/app/js
[Wed Mar 16 08:32:59 2011] [error] [client 10.40.1.2] (36)File name too long: Cannot map GET /static/app/js <..lots of javascript...>
[Wed Mar 16 08:32:59 2011][error][client 10.40.1.2](36)文件名太长:无法映射GET/static/app/js
看起来好像页面中的JavaScript是通过请求发送到服务器的。然而,目前尚不清楚这将如何发生。从互联网上的搜索结果来看,某些wordpress插件似乎发生了类似的事情,但没有太多其他信息
关于环境的注意事项:在英国,客户端使用在Citrix瘦客户端上运行的IE8。web服务器距离我们1700公里,所以有点延迟。该网站大量使用AJAX和大型cookie
有谁能建议如何调试这个问题吗
谢谢
Andrew我也明白了这一点,它使用了一个PHP框架,允许对URL进行格式化,以便
index.php?controller=doohickey&id=z61
可以重写为
index.php/controller/doohickey/z61
以及框架代码中的正则表达式
这些错误看起来像(/var/log/apache/error\u log):
->在本例中,apache将文件名解析为
/index.php/accounts_badoink/confirmaction/WUW%253DWBW%25253DV0tXPWM3Nzc1....
(我正在序列化一个对象状态并传递它)
我必须将其(至少是带有长附加序列化对象的URL)重写为更常见的样式:
GET /index.php?controller=accounts_badoink&confirmaction=WUW%253DWBW%25253DV0tXPWM3Nzc1....
->在本例中,Apache将文件名解析为index.php
因此,简而言之,重写URL并尽早包含?
,以将数据作为CGI样式的参数而不是路径元素传递
我为每个Apache进程id运行了strace-p$PID&
(由pidof apache2
报告):
要完成:
# kill -HUP `pidof strace`
请参阅apache2的内核调用:
accept(3, {sa_family=AF_INET, sin_port=htons(38985), sin_addr=inet_addr("127.0.0.1")}, [16]) = 13
fcntl(13, F_GETFD) = 0
fcntl(13, F_SETFD, FD_CLOEXEC) = 0
fcntl(13, F_GETFL) = 0x2 (flags O_RDWR)
fcntl(13, F_SETFL, O_RDWR|O_NONBLOCK) = 0
read(13, "GET /newregcon/index.php/account"..., 8000) = 4949
write(2, "[Wed May 11 15:39:36 2011] [erro"..., 4451) = 4451
writev(13, [{"HTTP/1.1 403 Forbidden\r\nDate: We"..., 219}, {"<!DOCTYPE HTML PUBLIC \"-//IETF//"..., 4610}], 2) = 4829
查找apr\u filepath\u merge
srclib/apr/file\u io/unix/filepath.c
81:APR_DECLARE(apr_status_t) apr_filepath_merge(char **newpath,
82: const char *rootpath,
83: const char *addpath,
84: apr_int32_t flags,
85: apr_pool_t *p)
86:{
87: char *path;
88: apr_size_t rootlen; /* is the length of the src rootpath */
89: apr_size_t maxlen; /* maximum total path length */
149: rootlen = strlen(rootpath);
150: maxlen = rootlen + strlen(addpath) + 4; /* 4 for slashes at start, after
151: * root, and at end, plus trailing
152: * null */
153: if (maxlen > APR_PATH_MAX) {
154: return APR_ENAMETOOLONG;
155: }
查找APR\u PATH\u MAX
网络软件
./srclib/apr/include/apr.hnw:424:#define APR_PATH_MAX PATH_MAX
WIN32
./srclib/apr/include/apr.h.in
/* header files for PATH_MAX, _POSIX_PATH_MAX */
#if APR_HAVE_LIMITS_H
#include <limits.h>
我遇到的另一个相关问题是PHP5.2的SUHOSIN安全补丁集, 其中(除其他外)限制get参数长度(默认为512): 这是否意味着在它的末尾有很多
&file.js&file2.js
?如果是这样,那么就需要缩短它。如果您指定您正在使用的插件以及
中包含的内容,这将更有帮助?(只是javascript代码?)是javascript源代码,而不是文件名。
81:APR_DECLARE(apr_status_t) apr_filepath_merge(char **newpath,
82: const char *rootpath,
83: const char *addpath,
84: apr_int32_t flags,
85: apr_pool_t *p)
86:{
87: char *path;
88: apr_size_t rootlen; /* is the length of the src rootpath */
89: apr_size_t maxlen; /* maximum total path length */
149: rootlen = strlen(rootpath);
150: maxlen = rootlen + strlen(addpath) + 4; /* 4 for slashes at start, after
151: * root, and at end, plus trailing
152: * null */
153: if (maxlen > APR_PATH_MAX) {
154: return APR_ENAMETOOLONG;
155: }
./srclib/apr/include/apr.hnw:424:#define APR_PATH_MAX PATH_MAX
./srclib/apr/include/apr.hw:584:#define APR_PATH_MAX 8192
/* header files for PATH_MAX, _POSIX_PATH_MAX */
#if APR_HAVE_LIMITS_H
#include <limits.h>
#define PATH_MAX 4096 /* # chars in a path name including nul */