【发布时间】:2016-03-19 23:55:13
【问题描述】:
我有以下网址可以重置我的密码:
http://example.com/resetPassword/LtoyURJd5AYuP3KEGg4gx8fvUprT37LBQDlvhg22qjg=.eyJ0b2tlbiI6IiQyeSQxMCRMTlgzU29HdEdOaExsay5yQ1puQ2ZlZ1wvbVNcL09BMDV2SjhcL1wvcHNRNjZaQmRpbWpOdnhGQlciLCJ0aW1lIjoiMjAxNS0xMi0xMVQwOTozOToyOSswMTAwIiwiZW1haWwiOiJsb3JlbS51dC5hbGlxdWFtQGZldWdpYXRwbGFjZXJhdHZlbGl0Lm9yZyJ9
在本地开发机器上它可以正常工作。但是在公共服务器(托管在亚马逊 ec2 上)上,我得到了一个 414 Uri。我试图修复它,但我似乎无法解决问题。 ps:我已将 url 替换为 example.com
我尝试将以下行添加到 /etc/apache2/apache2.conf,即 vhosts conf。既是同时又是分开的。是的。我也每次都重启了apache服务。
LimitRequestLine 8190
另外,当我请求其他长网址时,也没有问题。例如。我重命名了 robots.txt,所以我可以请求以下网址:
http://example.com/robotsrobotsrobotsrobotsrobotsrobotsrobotsrobotsrobotsrobotsrobotsrobotsrobotsrobotsrobotsrobotsr/robotsrobotsrobotsrobotsrobotsrobotsrobotsrobotsrobotsrobotsrobotsrobotsrobotsrobotsrobotsrobotsrobotsroborobotsrobotsrobotsrobotsrobotsrobotsrobotsrobotsrobotsrobotsrobotsrobotsrobots.txtrobots.txtrobots.txtrobots.txtrobots.txtrobots.txtrobots.php?test=ok
http://example.com/robotsrobotsrobotsrobotsrobotsrobotsrobotsrobotsrobotsrobotsrobotsrobotsrobotsrobotsrobotsrobotsr/robotsrobotsrobotsrobotsrobotsrobotsrobotsrobotsrobotsrobotsrobotsrobotsrobotsrobotsrobotsrobotsrobotsroborobotsrobotsrobotsrobotsrobotsrobotsrobotsrobotsrobotsrobotsrobotsrobotsrobots.txtrobots.txtrobots.txtrobots.txtrobots.txtrobots.txtrobots.php
http://example.com/robots.txt?klsadjflkasdjflkdsajflkdsja=sdakjflksadjfoaiwsefnalkfjsdakjflksadjfoaiwsefnalkfjsdakjflksadjfoaiwsefnalkfjsdakjflksadjfoaiwsefnalkfjsdakjflksadjfoaiwsefnalkfjsdakjflksadjfoaiwsefnalkfjsdakjflksadjfoaiwsefnalkfj
我还将 robots.txt 移至其他位置并为其制定了重写规则。即使那样,它似乎也能正常工作。所以 mod_rewrite 似乎不是问题。
当 url 变长为 +/- 275 个字符时,就会出现问题。它与 273 的重置链接一起使用,更长的是 324 个字符。我认为机器人的长网址大约有 400 个字符。
我似乎也有我的虚拟主机没有正确加载的问题(我不知道这是否相关)。服务器总是重定向到默认定义的路径。不是虚拟主机。 apache2ctl -s 输出如下:
ubuntu@ip-172-31-28-19:~$ apache2ctl -S
VirtualHost configuration:
<ip>:80 example.com (/etc/apache2/apache2.conf:228)
ServerRoot: "/etc/apache2"
Main DocumentRoot: "/var/www/public"
Main ErrorLog: "/var/log/apache2/error.log"
Mutex proxy: using_defaults
Mutex default: dir="/var/lock/apache2" mechanism=fcntl
Mutex mpm-accept: using_defaults
Mutex watchdog-callback: using_defaults
Mutex rewrite-map: using_defaults
PidFile: "/var/run/apache2/apache2.pid"
Define: DUMP_VHOSTS
Define: DUMP_RUN_CFG
User: name="www-data" id=33 not_used
Group: name="www-data" id=33 not_used
2015 年 12 月 18 日更新 在与我团队中的其他开发人员讨论时,我们将为亚马逊上的该服务器选择不同的基础映像。似乎还有比这更多的问题。所以这个问题已经过时了。
【问题讨论】:
-
只是想一想,resetPassword 控制器(或其他)是否进行了重定向,重定向着陆页是否会导致 414?
-
不,它只是一个验证密钥并给出适当响应的获取。重置表单或发送错误消息。
-
您尝试过更改 LimitRequestFieldSize 吗?
-
特殊字符长度改为
%xx(x3) 必须考虑.. -
你确定 414 是 Apache 生成的吗?您是否捕获了逐字 HTTP 响应?也许有一些中介。
标签: php apache amazon-ec2 virtualhost apache2.4