我们在我们的 webapp 中使用 Redirect-after-Post 模式。
有时,我们的 apache 日志中显示的错误日志很少,如下所示:
[error] [...] client sent HTTP/1.1 request without hostname (see RFC2616 section 14.23): ...
在我的访问日志中,它们显示为
[...] "GET/xyz/HTTP/1.1"400 226 "-""-"72
这里发生的事情是:应用程序发送一个带有绝对 URL 的重定向,如下所示:
地点:http://www.kicktipp.de/demo/
今天我有三个浏览器,它们请求我们重定向到的 URL,而不需要 Host header :
这些都是正常的访问,用户点击了几个页面,然后重定向并失败并出现错误。
我知道一些旧的浏览器需要 http/1.1 的帮助,所以我们有默认的 debian setenv 配置:
<IfModule mod_setenvif.c>
#
# The following directives modify normal HTTP response behavior to
# handle known problems with browser implementations.
#
BrowserMatch "Mozilla/2" nokeepalive
BrowserMatch "MSIE 4\.0b2;" nokeepalive downgrade-1.0 force-response-1.0
BrowserMatch "RealPlayer 4\.0" force-response-1.0
BrowserMatch "Java/1\.0" force-response-1.0
BrowserMatch "JDK/1\.0" force-response-1.0
#
# The following directive disables redirects on non-GET requests for
# a directory that does not include the trailing slash. This fixes a
# problem with Microsoft WebFolders which does not appropriately handle
# redirects for folders with DAV methods.
# Same deal with Apple's DAV filesystem and Gnome VFS support for DAV.
#
BrowserMatch "Microsoft Data Access Internet Publishing Provider" redirect-carefully
BrowserMatch "MS FrontPage" redirect-carefully
BrowserMatch "^WebDrive" redirect-carefully
BrowserMatch "^WebDAVFS/1.[012]" redirect-carefully
BrowserMatch "^gnome-vfs/1.0" redirect-carefully
BrowserMatch "^XML Spy" redirect-carefully
BrowserMatch "^Dreamweaver-WebDAV-SCM1" redirect-carefully
</IfModule>
每 10000 次重定向仅发生一次。但我当然希望满足每个用户和每个浏览器。
有什么提示可以给我吗?我们是否需要在 mod_setenvif 配置中添加更多浏览器?
最佳答案
关于redirect - IE6 和 IE7 在重定向时发送没有主机名的 HTTP/1.1,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1497337/