Correctly shutting down a websocket handler
by Robin Anil
When a client disconnects, I see that onClose is not being fired. The only
way this seems to be firing if client sents a close frame.
Is there any way to detect disconnection and immediately close all the
opened resources.
Robin
Robin Anil | Software Engineer
1 year, 3 months
reverse proxy doesn't work for post request
by Steve Hu
Hi,
I am trying to build a RESTful reverse proxy in order to wrap up APIs built
with other Java frameworks or other languages. The codebase is copied from
the reverse proxy example and I have a tutorial to document the steps to
reproduce the error. I am just wondering if there are anything I missed or
this is a bug.
Thanks,
Steve
Here the tutorial
https://networknt.github.io/light-proxy/tutorial/
And here is the error
14:04:03.357 [XNIO-1 I/O-1] ERROR io.undertow.proxy handleFailure -
UT005028: Proxy request to /v1/postData failed
io.undertow.server.TruncatedResponseException: null
at
io.undertow.client.http.HttpRequestConduit.truncateWrites(HttpRequestConduit.java:711)
at
io.undertow.conduits.AbstractFixedLengthStreamSinkConduit.terminateWrites(AbstractFixedLengthStreamSinkConduit.java:256)
at
org.xnio.conduits.ConduitStreamSinkChannel.shutdownWrites(ConduitStreamSinkChannel.java:178)
at
io.undertow.channels.DetachableStreamSinkChannel.shutdownWrites(DetachableStreamSinkChannel.java:79)
at
io.undertow.server.handlers.proxy.ProxyHandler$HTTPTrailerChannelListener.handleEvent(ProxyHandler.java:736)
at
io.undertow.server.handlers.proxy.ProxyHandler$ProxyAction$1.completed(ProxyHandler.java:628)
at
io.undertow.server.handlers.proxy.ProxyHandler$ProxyAction$1.completed(ProxyHandler.java:543)
at
io.undertow.client.http.HttpClientExchange.invokeReadReadyCallback(HttpClientExchange.java:212)
at
io.undertow.client.http.HttpClientConnection.initiateRequest(HttpClientConnection.java:418)
at
io.undertow.client.http.HttpClientConnection.sendRequest(HttpClientConnection.java:350)
at
io.undertow.server.handlers.proxy.ProxyHandler$ProxyAction.run(ProxyHandler.java:543)
at io.undertow.util.SameThreadExecutor.execute(SameThreadExecutor.java:35)
at
io.undertow.server.HttpServerExchange.dispatch(HttpServerExchange.java:797)
at
io.undertow.server.handlers.proxy.ProxyHandler$ProxyClientHandler.completed(ProxyHandler.java:298)
at
io.undertow.server.handlers.proxy.ProxyHandler$ProxyClientHandler.completed(ProxyHandler.java:272)
at
io.undertow.server.handlers.proxy.ProxyConnectionPool.connectionReady(ProxyConnectionPool.java:338)
at
io.undertow.server.handlers.proxy.ProxyConnectionPool.access$900(ProxyConnectionPool.java:61)
at
io.undertow.server.handlers.proxy.ProxyConnectionPool$2.completed(ProxyConnectionPool.java:286)
at
io.undertow.server.handlers.proxy.ProxyConnectionPool$2.completed(ProxyConnectionPool.java:273)
at
io.undertow.client.http.HttpClientProvider.handleConnected(HttpClientProvider.java:156)
at
io.undertow.client.http.HttpClientProvider.access$000(HttpClientProvider.java:51)
at
io.undertow.client.http.HttpClientProvider$2.handleEvent(HttpClientProvider.java:127)
at
io.undertow.client.http.HttpClientProvider$2.handleEvent(HttpClientProvider.java:124)
at org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:92)
at
org.xnio.nio.WorkerThread$ConnectHandle.handleReady(WorkerThread.java:326)
at org.xnio.nio.WorkerThread.run(WorkerThread.java:561)
14:05:03.462 [XNIO-1 I/O-1] ERROR io.undertow.proxy handleFailure -
UT005028: Proxy request to /v1/postData failed
java.io.IOException: UT001000: Connection closed
at
io.undertow.client.http.HttpClientConnection$ClientReadListener.handleEvent(HttpClientConnection.java:573)
at
io.undertow.client.http.HttpClientConnection$ClientReadListener.handleEvent(HttpClientConnection.java:511)
at org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:92)
at
org.xnio.conduits.ReadReadyHandler$ChannelListenerHandler.readReady(ReadReadyHandler.java:66)
at org.xnio.nio.NioSocketConduit.handleReady(NioSocketConduit.java:88)
at org.xnio.nio.WorkerThread.run(WorkerThread.java:561)
7 years, 3 months
SSL Proxying
by Hicks, Matt
I'm using Undertow 1.4.20.Final and attempting to proxy an SSL connection
to another Undertow server (also running 1.4.20.Final). However, I'm
getting the following error:
error: Sep 14, 2017 1:25:29 PM
io.undertow.server.handlers.proxy.ProxyHandler handleFailure
error: ERROR: UT005028: Proxy request to /drive failed
error: java.io.IOException: UT001000: Connection closed
error: at
io.undertow.client.http.HttpClientConnection$ClientReadListener.handleEvent(HttpClientConnection.java:578)
error: at
io.undertow.client.http.HttpClientConnection$ClientReadListener.handleEvent(HttpClientConnection.java:516)
error: at
org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:92)
error: at
org.xnio.conduits.ReadReadyHandler$ChannelListenerHandler.readReady(ReadReadyHandler.java:66)
error: at
org.xnio.nio.NioSocketConduit.handleReady(NioSocketConduit.java:88)
error: at org.xnio.nio.WorkerThread.run(WorkerThread.java:561)
I've done this in earlier versions of Undertow and it didn't have any
trouble, and I don't think the code has changed. I'm using the same
certificate on both the proxy and the internal server. Unfortunately this
error gives me very little information to diagnose the problem.
Any suggestions are appreciated.
Thanks,
Matt
7 years, 3 months
Streaming a ZIP file
by Hicks, Matt
I'm trying to create ZIP files on-demand from the server and stream them
back to the browser, but I'm not sure the proper way to do this. The only
way I can think of is to use a `ZipOutputStream`, but that would be a
blocking operation. Is there a better way to do this?
7 years, 3 months