Java Tomcat 7.0.43“信息:解析 HTTP 请求标头时出错”
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/18819180/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Tomcat 7.0.43 "INFO: Error parsing HTTP request header"
提问by confile
I use Tomcat 7.0.43 with a websocket application. My app works fine in Tomcat 7.0.42 but with 43 I get the following output when I try to access my server on websockets:
我将 Tomcat 7.0.43 与 websocket 应用程序一起使用。我的应用程序在 Tomcat 7.0.42 中运行良好,但是当我尝试在 websockets 上访问我的服务器时,使用 43 我得到以下输出:
Sep 16, 2013 3:08:34 AM org.apache.coyote.http11.AbstractHttp11Processor process
INFO: Error parsing HTTP request header
Note: further occurrences of HTTP header parsing errors will be logged at DEBUG level.
My browser console shows the following:
我的浏览器控制台显示以下内容:
WebSocket connection to 'ws://www.testapp.com/socket/notification/848df2e62fcf93e1b3?X-Atmosphere-tracking-i…Date=0&Content-Type=application/json;%20charset=UTF-8&X-atmo-protocol=true' failed: Unrecognized frame opcode: 5
Here is the access log for that request:
这是该请求的访问日志:
"GET /socket/notification/848df2e62fcf93e1b3?X-Atmosphere-tracking-id=0&X-Atmosphere-Framework=2.0.2-javascript&X-Atmosphere-Transport=websocket&X-Atmosphere-TrackMessageSize=true&X-Cache-Date=0&Content-Type=application/json;%20charset=UTF-8&X-atmo-protocol=true HTTP/1.1"
What has changed in Tomcat 7.0.43? What do I have to change?
Tomcat 7.0.43 有什么变化?我需要改变什么?
采纳答案by ben rhouma moez
If you have this listener:
如果你有这个听众:
<Listener className="org.apache.catalina.core.AprLifecycleListener" SSLEngine="on"/>
on your server.xml, remove it and try. You can not use a keystore if you are using the APR connector
在您的 server.xml 上,将其删除并尝试。如果您使用的是 APR 连接器,则不能使用密钥库
回答by Kimchi Man
If there are too many cookies cached, it breaks the server (the size of a request header is too big!). Clearing the cookies can fix this issue as well.
如果缓存了太多 cookie,它会破坏服务器(请求头的大小太大!)。清除 cookie 也可以解决此问题。
回答by nkatsar
I had a similar issue, I was sending a POST request (using RESTClient plugin for Firefox) with data in the request body and was receiving the same message.
我有一个类似的问题,我在请求正文中发送一个带有数据的 POST 请求(使用 RESTClient 插件 for Firefox)并收到相同的消息。
In my case this happened because I was trying to use HTTPS protocol in a local tomcat instance where HTTPS was not configured.
就我而言,发生这种情况是因为我试图在未配置 HTTPS 的本地 tomcat 实例中使用 HTTPS 协议。
回答by Philippe
For me, the problem was passing in a larger than normally expected HTTP header. I resolved it by setting maxHttpHeaderSize="1048576" attribute on the Connector node in server.xml.
对我来说,问题是传入了比正常预期更大的 HTTP 标头。我通过在 server.xml 中的连接器节点上设置 maxHttpHeaderSize="1048576" 属性来解决它。
回答by Abhishek Soni
I tried all of the above, nothing worked for me. Then I changed tomcat port numbers both HTTP/1.1 and Tomcat admin port and it got solved.
我尝试了上述所有方法,对我没有任何效果。然后我更改了 HTTP/1.1 和 Tomcat 管理端口的 tomcat 端口号,它得到了解决。
I see other solutions above worked for the people but it is worth to try this one if any of the above doesn't work.
我看到上面的其他解决方案适用于人们,但如果上述任何一个不起作用,那么值得尝试这个。
Thanks everyone!
谢谢大家!
回答by Atais
In our case it turned out that the error happened because we have a custom filter
in our application which does HttpServletResponse sendRedirect()
to other url.
在我们的例子中,结果证明错误发生是因为我们filter
的应用程序中有一个HttpServletResponse sendRedirect()
对其他 url执行的自定义。
For some reason, the redirection is not closing the keep-alive
status of the connection, hence the timeout exception.
由于某种原因,重定向没有关闭keep-alive
连接的状态,因此超时异常。
We checked with Tomcat Docsand when we disabled the maxKeepAliveRequests
by setting it's value to 1
and the error stopped showing up.
我们检查了Tomcat Docs,当我们maxKeepAliveRequests
通过将其值设置为禁用时1
,错误停止显示。
For now we do not have the actual solution to the error.
目前我们还没有针对该错误的实际解决方案。
回答by Piotr K.
My problem occurs when I try to open https. I don't use SSL.
当我尝试打开https时出现我的问题。我不使用 SSL。
It's Tomcat bug.
这是 Tomcat 的错误。
Today 12/02/2017newest official version from Debian repositories is Tomcat 8.0.14
今天12/02/2017来自 Debian 仓库的最新官方版本是Tomcat 8.0.14
Solution is to download from official site and install newest package of Tomcat 8, 8.5, 9or upgrade to newest version(8.5.x) from jessie-backports
解决方案是从官方网站下载并安装Tomcat 8、8.5、9的最新包或从jessie-backports升级到最新版本(8.5.x)
Debian 8
Debian 8
Add to /etc/apt/sources.list
添加到/etc/apt/sources.list
deb http://ftp.debian.org/debian jessie-backports main
Then update and install Tomcat from jessie-backports
然后从 jessie-backports 更新并安装 Tomcat
sudo apt-get update && sudo apt-get -t jessie-backports install tomcat8
回答by Lujun Zhou
If you don't want to upgrade your tomcat,
Add this line in your catalina.properties
如果您不想升级您的 tomcat,请在您的 catalina.properties
tomcat.util.http.parser.HttpParser.requestTargetAllow=|{}
It works for me http://www.zhoulujun.cn/zhoulujun/html/java/tomcat/2018_0508_8109.html
它对我 有用 http://www.zhoulujun.cn/zhoulujun/html/java/tomcat/2018_0508_8109.html
回答by Gondy
Check, if you are not accidentally requesting HTTPS protocol instead of HTTP.
检查,如果您没有意外请求 HTTPS 协议而不是 HTTP。
I have overlooked that I was requesting https://localhost:...
instead of http://localhost:...
and it resulted to this weird message..
我忽略了我正在请求https://localhost:...
而不是http://localhost:...
它导致了这个奇怪的消息..