Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Tomcat 7.0.43 "INFO: Error parsing HTTP request header"

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:

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?

like image 607
confile Avatar asked Sep 16 '13 01:09

confile


People also ask

What is the default header size in Tomcat?

In a Spring Boot application, the max HTTP header size is configured using server. max-http-header-size. The actual default value for Tomcat and Jetty is 8kB, and the default value for Undertow is 1MB.

What is maxHttpHeaderSize?

maxHttpHeaderSize. The maximum size of the request and response HTTP header, specified in bytes. If not specified, this attribute is set to 8192 (8 KB). maxKeepAliveRequests. The maximum number of HTTP requests which can be pipelined until the connection is closed by the server.


2 Answers

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

like image 165
ben rhouma moez Avatar answered Oct 11 '22 10:10

ben rhouma moez


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.

like image 32
Philippe Avatar answered Oct 11 '22 10:10

Philippe