From sdouglas at redhat.com Fri Sep 1 00:46:57 2017 From: sdouglas at redhat.com (Stuart Douglas) Date: Fri, 1 Sep 2017 14:46:57 +1000 Subject: [undertow-dev] Streaming a ZIP file In-Reply-To: References: Message-ID: You could potentially adapt io.undertow.conduits.DeflatingStreamSinkConduit, which uses a java.util.zip.Deflater. Stuart On Fri, Sep 1, 2017 at 5:57 AM, Hicks, Matt wrote: > 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? > > _______________________________________________ > undertow-dev mailing list > undertow-dev at lists.jboss.org > https://lists.jboss.org/mailman/listinfo/undertow-dev From matt at matthicks.com Tue Sep 5 11:31:20 2017 From: matt at matthicks.com (Hicks, Matt) Date: Tue, 05 Sep 2017 15:31:20 +0000 Subject: [undertow-dev] Streaming a ZIP file In-Reply-To: References: Message-ID: I've looked at DeflatingStreamSinkConduit, but am at a loss to figure out how to adapt this to streaming a zip file. Is there any other information you could give me? Thanks On Thu, Aug 31, 2017 at 11:46 PM Stuart Douglas wrote: > You could potentially adapt > io.undertow.conduits.DeflatingStreamSinkConduit, which uses a > java.util.zip.Deflater. > > Stuart > > On Fri, Sep 1, 2017 at 5:57 AM, Hicks, Matt wrote: > > 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? > > > > _______________________________________________ > > undertow-dev mailing list > > undertow-dev at lists.jboss.org > > https://lists.jboss.org/mailman/listinfo/undertow-dev > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.jboss.org/pipermail/undertow-dev/attachments/20170905/c945ed40/attachment.html From sdouglas at redhat.com Tue Sep 5 17:39:08 2017 From: sdouglas at redhat.com (Stuart Douglas) Date: Wed, 6 Sep 2017 07:39:08 +1000 Subject: [undertow-dev] Streaming a ZIP file In-Reply-To: References: Message-ID: My bad, I did not read your post properly and was thinking of gzip. I think you can still use ZipOutputStream though, it will only be blocking if the underlying Stream is blocking, so using something like a ByteArrayOutputStream would make the operation non blocking. If you want to avoid buffering the whole zip in memory you could potentially alternate between writing data to the ZipOutputStream and then taking anything written to the ByteArrayOutputStream and flushing it to the response channel. Stuart On Wed, Sep 6, 2017 at 1:31 AM, Hicks, Matt wrote: > I've looked at DeflatingStreamSinkConduit, but am at a loss to figure out > how to adapt this to streaming a zip file. Is there any other information > you could give me? > > Thanks > > On Thu, Aug 31, 2017 at 11:46 PM Stuart Douglas wrote: >> >> You could potentially adapt >> io.undertow.conduits.DeflatingStreamSinkConduit, which uses a >> java.util.zip.Deflater. >> >> Stuart >> >> On Fri, Sep 1, 2017 at 5:57 AM, Hicks, Matt wrote: >> > 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? >> > >> > _______________________________________________ >> > undertow-dev mailing list >> > undertow-dev at lists.jboss.org >> > https://lists.jboss.org/mailman/listinfo/undertow-dev From matt at matthicks.com Tue Sep 5 21:38:58 2017 From: matt at matthicks.com (Hicks, Matt) Date: Wed, 06 Sep 2017 01:38:58 +0000 Subject: [undertow-dev] Streaming a ZIP file In-Reply-To: References: Message-ID: Great, thanks! Are there any examples of using an OutputStream with Undertow? On Tue, Sep 5, 2017, 4:39 PM Stuart Douglas wrote: > My bad, I did not read your post properly and was thinking of gzip. > > I think you can still use ZipOutputStream though, it will only be > blocking if the underlying Stream is blocking, so using something like > a ByteArrayOutputStream would make the operation non blocking. If you > want to avoid buffering the whole zip in memory you could potentially > alternate between writing data to the ZipOutputStream and then taking > anything written to the ByteArrayOutputStream and flushing it to the > response channel. > > Stuart > > On Wed, Sep 6, 2017 at 1:31 AM, Hicks, Matt wrote: > > I've looked at DeflatingStreamSinkConduit, but am at a loss to figure out > > how to adapt this to streaming a zip file. Is there any other > information > > you could give me? > > > > Thanks > > > > On Thu, Aug 31, 2017 at 11:46 PM Stuart Douglas > wrote: > >> > >> You could potentially adapt > >> io.undertow.conduits.DeflatingStreamSinkConduit, which uses a > >> java.util.zip.Deflater. > >> > >> Stuart > >> > >> On Fri, Sep 1, 2017 at 5:57 AM, Hicks, Matt wrote: > >> > 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? > >> > > >> > _______________________________________________ > >> > undertow-dev mailing list > >> > undertow-dev at lists.jboss.org > >> > https://lists.jboss.org/mailman/listinfo/undertow-dev > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.jboss.org/pipermail/undertow-dev/attachments/20170906/d480d6ea/attachment.html From me at christophsturm.com Wed Sep 6 03:40:55 2017 From: me at christophsturm.com (Christoph Sturm) Date: Wed, 6 Sep 2017 09:40:55 +0200 Subject: [undertow-dev] Streaming a ZIP file In-Reply-To: References: Message-ID: you can send async with exchange.getResponseSender().send(?, callback) > On 06.09.2017, at 03:38, Hicks, Matt wrote: > > Great, thanks! Are there any examples of using an OutputStream with Undertow? > > > On Tue, Sep 5, 2017, 4:39 PM Stuart Douglas > wrote: > My bad, I did not read your post properly and was thinking of gzip. > > I think you can still use ZipOutputStream though, it will only be > blocking if the underlying Stream is blocking, so using something like > a ByteArrayOutputStream would make the operation non blocking. If you > want to avoid buffering the whole zip in memory you could potentially > alternate between writing data to the ZipOutputStream and then taking > anything written to the ByteArrayOutputStream and flushing it to the > response channel. > > Stuart > > On Wed, Sep 6, 2017 at 1:31 AM, Hicks, Matt > wrote: > > I've looked at DeflatingStreamSinkConduit, but am at a loss to figure out > > how to adapt this to streaming a zip file. Is there any other information > > you could give me? > > > > Thanks > > > > On Thu, Aug 31, 2017 at 11:46 PM Stuart Douglas > wrote: > >> > >> You could potentially adapt > >> io.undertow.conduits.DeflatingStreamSinkConduit, which uses a > >> java.util.zip.Deflater. > >> > >> Stuart > >> > >> On Fri, Sep 1, 2017 at 5:57 AM, Hicks, Matt > wrote: > >> > 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? > >> > > >> > _______________________________________________ > >> > undertow-dev mailing list > >> > undertow-dev at lists.jboss.org > >> > https://lists.jboss.org/mailman/listinfo/undertow-dev > _______________________________________________ > undertow-dev mailing list > undertow-dev at lists.jboss.org > https://lists.jboss.org/mailman/listinfo/undertow-dev -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.jboss.org/pipermail/undertow-dev/attachments/20170906/df8c6db9/attachment.html From darran.lofthouse at jboss.com Fri Sep 8 12:17:02 2017 From: darran.lofthouse at jboss.com (Darran Lofthouse) Date: Fri, 08 Sep 2017 16:17:02 +0000 Subject: [undertow-dev] Using WildFly Elytron with Undertow Message-ID: The WildFly Elytron project which has been added to provide security for WildFly 11 is also usable independently of the application server. The following blog post demonstrates how WildFly Elytron can be used to add security to Undertows HelloWorld example: - http://darranl.blogspot.co.uk/2017/09/using-wildfly-elytron-with-undertow.html Regards, Darran Lofthouse. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.jboss.org/pipermail/undertow-dev/attachments/20170908/9923415f/attachment.html From matt at matthicks.com Thu Sep 14 14:29:45 2017 From: matt at matthicks.com (Hicks, Matt) Date: Thu, 14 Sep 2017 18:29:45 +0000 Subject: [undertow-dev] SSL Proxying Message-ID: 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 -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.jboss.org/pipermail/undertow-dev/attachments/20170914/3e891242/attachment.html From sdouglas at redhat.com Thu Sep 14 17:49:40 2017 From: sdouglas at redhat.com (Stuart Douglas) Date: Fri, 15 Sep 2017 07:49:40 +1000 Subject: [undertow-dev] SSL Proxying In-Reply-To: References: Message-ID: What was the earlier version that you were using, just so I can get an idea what may have changed? The reason why that error message is not really informative is because it looks like the server is just closing the connection cleanly (i.e. the client reads -1), so it is likely that the server is closing the connection for some reason. Stuart On Fri, Sep 15, 2017 at 4:29 AM, Hicks, Matt wrote: > 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 > > _______________________________________________ > undertow-dev mailing list > undertow-dev at lists.jboss.org > https://lists.jboss.org/mailman/listinfo/undertow-dev From stevehu at gmail.com Sat Sep 16 14:37:37 2017 From: stevehu at gmail.com (Steve Hu) Date: Sat, 16 Sep 2017 14:37:37 -0400 Subject: [undertow-dev] reverse proxy doesn't work for post request Message-ID: 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) -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.jboss.org/pipermail/undertow-dev/attachments/20170916/64f30575/attachment.html From sdouglas at redhat.com Mon Sep 18 01:13:57 2017 From: sdouglas at redhat.com (Stuart Douglas) Date: Mon, 18 Sep 2017 07:13:57 +0200 Subject: [undertow-dev] reverse proxy doesn't work for post request In-Reply-To: References: Message-ID: This looks really odd. It looks like the client request is expecting there to be a request body, however the server request thinks the request is finished and there is no request body available. Is it possible an earlier handler is reading the request body so the proxy handler can't access it? Stuart On Sat, Sep 16, 2017 at 8:37 PM, Steve Hu wrote: > 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) > > > > _______________________________________________ > undertow-dev mailing list > undertow-dev at lists.jboss.org > https://lists.jboss.org/mailman/listinfo/undertow-dev From stevehu at gmail.com Mon Sep 18 06:50:19 2017 From: stevehu at gmail.com (Steve Hu) Date: Mon, 18 Sep 2017 06:50:19 -0400 Subject: [undertow-dev] reverse proxy doesn't work for post request In-Reply-To: References: Message-ID: Thanks Stuart. My bad :( I had a body parser handler in the request/response chain in order to do schema validation on body against swagger specification and it consumed the body stream on the proxy server. Is there a way I can consume the body and put the body stream back so that other downstream handler can still parse the body if needed? Steve On Mon, Sep 18, 2017 at 1:13 AM, Stuart Douglas wrote: > This looks really odd. It looks like the client request is expecting > there to be a request body, however the server request thinks the > request is finished and there is no request body available. Is it > possible an earlier handler is reading the request body so the proxy > handler can't access it? > > Stuart > > On Sat, Sep 16, 2017 at 8:37 PM, Steve Hu wrote: > > 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.AbstractFixedLengthStreamSinkC > onduit.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) > > > > > > > > _______________________________________________ > > undertow-dev mailing list > > undertow-dev at lists.jboss.org > > https://lists.jboss.org/mailman/listinfo/undertow-dev > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.jboss.org/pipermail/undertow-dev/attachments/20170918/c78fb3eb/attachment-0001.html From sdouglas at redhat.com Mon Sep 18 08:22:29 2017 From: sdouglas at redhat.com (Stuart Douglas) Date: Mon, 18 Sep 2017 14:22:29 +0200 Subject: [undertow-dev] reverse proxy doesn't work for post request In-Reply-To: References: Message-ID: Have a look at io.undertow.server.Connectors#ungetRequestBytes(), it should do what you are after. Stuart On Mon, Sep 18, 2017 at 12:50 PM, Steve Hu wrote: > Thanks Stuart. My bad :( I had a body parser handler in the request/response > chain in order to do schema validation on body against swagger specification > and it consumed the body stream on the proxy server. Is there a way I can > consume the body and put the body stream back so that other downstream > handler can still parse the body if needed? > > Steve > > On Mon, Sep 18, 2017 at 1:13 AM, Stuart Douglas wrote: >> >> This looks really odd. It looks like the client request is expecting >> there to be a request body, however the server request thinks the >> request is finished and there is no request body available. Is it >> possible an earlier handler is reading the request body so the proxy >> handler can't access it? >> >> Stuart >> >> On Sat, Sep 16, 2017 at 8:37 PM, Steve Hu wrote: >> > 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) >> > >> > >> > >> > _______________________________________________ >> > undertow-dev mailing list >> > undertow-dev at lists.jboss.org >> > https://lists.jboss.org/mailman/listinfo/undertow-dev > > From stevehu at gmail.com Mon Sep 18 08:25:35 2017 From: stevehu at gmail.com (Steve Hu) Date: Mon, 18 Sep 2017 08:25:35 -0400 Subject: [undertow-dev] reverse proxy doesn't work for post request In-Reply-To: References: Message-ID: Cool. Thanks a lot for your help. On Mon, Sep 18, 2017 at 8:22 AM, Stuart Douglas wrote: > Have a look at io.undertow.server.Connectors#ungetRequestBytes(), it > should do what you are after. > > Stuart > > On Mon, Sep 18, 2017 at 12:50 PM, Steve Hu wrote: > > Thanks Stuart. My bad :( I had a body parser handler in the > request/response > > chain in order to do schema validation on body against swagger > specification > > and it consumed the body stream on the proxy server. Is there a way I can > > consume the body and put the body stream back so that other downstream > > handler can still parse the body if needed? > > > > Steve > > > > On Mon, Sep 18, 2017 at 1:13 AM, Stuart Douglas > wrote: > >> > >> This looks really odd. It looks like the client request is expecting > >> there to be a request body, however the server request thinks the > >> request is finished and there is no request body available. Is it > >> possible an earlier handler is reading the request body so the proxy > >> handler can't access it? > >> > >> Stuart > >> > >> On Sat, Sep 16, 2017 at 8:37 PM, Steve Hu wrote: > >> > 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.AbstractFixedLengthStreamSinkC > onduit.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) > >> > > >> > > >> > > >> > _______________________________________________ > >> > undertow-dev mailing list > >> > undertow-dev at lists.jboss.org > >> > https://lists.jboss.org/mailman/listinfo/undertow-dev > > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.jboss.org/pipermail/undertow-dev/attachments/20170918/0913c3c8/attachment.html