Tomcat EOFException when nginx is Reverse Proxy for WebSockets

Igal @ Lucee.org igal at lucee.org
Tue Mar 21 06:40:10 UTC 2017


I am getting an EOFException after a couple of minutes when connecting 
via nginx that acts as reverse proxy.

I am running Windows 2008R2 server, with Tomcat 8.5.12, and nginx 1.11.10

When connecting directly to Tomcat I do not see this issue, but direct
connection is locally (i.e. network connection is not a factor) while
connection via nginx goes over the internet.

My nginx config is as follows:

## WebSocket begin
location /ws/ {

     proxy_pass http://lucee_servers_81xx;
     proxy_http_version 1.1;
     proxy_set_header Upgrade $http_upgrade;
     proxy_set_header Connection "upgrade";
}
## WebSocket end

Java Stack Trace: java.io.EOFException
   org.apache.tomcat.util.net.NioEndpoint$NioSocketWrapper.fillReadBuffer(NioEndpoint.java:1228)
   org.apache.tomcat.util.net.NioEndpoint$NioSocketWrapper.read(NioEndpoint.java:1168)
   org.apache.tomcat.websocket.server.WsFrameServer.onDataAvailable(WsFrameServer.java:63)
   org.apache.tomcat.websocket.server.WsHttpUpgradeHandler.upgradeDispatch(WsHttpUpgradeHandler.java:148)
   org.apache.coyote.http11.upgrade.UpgradeProcessorInternal.dispatch(UpgradeProcessorInternal.java:54)
   org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:53)
   org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:798)
   org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1441)
   org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
   java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
   java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
   org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
   java.lang.Thread.run(Thread.java:745)

Any ideas?

I will post a similar question to the Tomcat mailing list. Thanks!


More information about the nginx mailing list