<div dir="ltr">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?<div><br></div><div>Steve</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Sep 18, 2017 at 1:13 AM, Stuart Douglas <span dir="ltr"><<a href="mailto:sdouglas@redhat.com" target="_blank">sdouglas@redhat.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">This looks really odd. It looks like the client request is expecting<br>
there to be a request body, however the server request thinks the<br>
request is finished and there is no request body available. Is it<br>
possible an earlier handler is reading the request body so the proxy<br>
handler can't access it?<br>
<br>
Stuart<br>
<div><div class="h5"><br>
On Sat, Sep 16, 2017 at 8:37 PM, Steve Hu <<a href="mailto:stevehu@gmail.com">stevehu@gmail.com</a>> wrote:<br>
> Hi,<br>
><br>
> I am trying to build a RESTful reverse proxy in order to wrap up APIs built<br>
> with other Java frameworks or other languages. The codebase is copied from<br>
> the reverse proxy example and I have a tutorial to document the steps to<br>
> reproduce the error. I am just wondering if there are anything I missed or<br>
> this is a bug.<br>
><br>
> Thanks,<br>
><br>
> Steve<br>
><br>
> Here the tutorial<br>
><br>
> <a href="https://networknt.github.io/light-proxy/tutorial/" rel="noreferrer" target="_blank">https://networknt.github.io/<wbr>light-proxy/tutorial/</a><br>
><br>
> And here is the error<br>
><br>
> 14:04:03.357 [XNIO-1 I/O-1] ERROR io.undertow.proxy handleFailure -<br>
> UT005028: Proxy request to /v1/postData failed<br>
> io.undertow.server.<wbr>TruncatedResponseException: null<br>
> at<br>
> io.undertow.client.http.<wbr>HttpRequestConduit.<wbr>truncateWrites(<wbr>HttpRequestConduit.java:711)<br>
> at<br>
> io.undertow.conduits.<wbr>AbstractFixedLengthStreamSinkC<wbr>onduit.terminateWrites(<wbr>AbstractFixedLengthStreamSinkC<wbr>onduit.java:256)<br>
> at<br>
> org.xnio.conduits.<wbr>ConduitStreamSinkChannel.<wbr>shutdownWrites(<wbr>ConduitStreamSinkChannel.java:<wbr>178)<br>
> at<br>
> io.undertow.channels.<wbr>DetachableStreamSinkChannel.<wbr>shutdownWrites(<wbr>DetachableStreamSinkChannel.<wbr>java:79)<br>
> at<br>
> io.undertow.server.handlers.<wbr>proxy.ProxyHandler$<wbr>HTTPTrailerChannelListener.<wbr>handleEvent(ProxyHandler.java:<wbr>736)<br>
> at<br>
> io.undertow.server.handlers.<wbr>proxy.ProxyHandler$<wbr>ProxyAction$1.completed(<wbr>ProxyHandler.java:628)<br>
> at<br>
> io.undertow.server.handlers.<wbr>proxy.ProxyHandler$<wbr>ProxyAction$1.completed(<wbr>ProxyHandler.java:543)<br>
> at<br>
> io.undertow.client.http.<wbr>HttpClientExchange.<wbr>invokeReadReadyCallback(<wbr>HttpClientExchange.java:212)<br>
> at<br>
> io.undertow.client.http.<wbr>HttpClientConnection.<wbr>initiateRequest(<wbr>HttpClientConnection.java:418)<br>
> at<br>
> io.undertow.client.http.<wbr>HttpClientConnection.<wbr>sendRequest(<wbr>HttpClientConnection.java:350)<br>
> at<br>
> io.undertow.server.handlers.<wbr>proxy.ProxyHandler$<wbr>ProxyAction.run(ProxyHandler.<wbr>java:543)<br>
> at io.undertow.util.<wbr>SameThreadExecutor.execute(<wbr>SameThreadExecutor.java:35)<br>
> at<br>
> io.undertow.server.<wbr>HttpServerExchange.dispatch(<wbr>HttpServerExchange.java:797)<br>
> at<br>
> io.undertow.server.handlers.<wbr>proxy.ProxyHandler$<wbr>ProxyClientHandler.completed(<wbr>ProxyHandler.java:298)<br>
> at<br>
> io.undertow.server.handlers.<wbr>proxy.ProxyHandler$<wbr>ProxyClientHandler.completed(<wbr>ProxyHandler.java:272)<br>
> at<br>
> io.undertow.server.handlers.<wbr>proxy.ProxyConnectionPool.<wbr>connectionReady(<wbr>ProxyConnectionPool.java:338)<br>
> at<br>
> io.undertow.server.handlers.<wbr>proxy.ProxyConnectionPool.<wbr>access$900(<wbr>ProxyConnectionPool.java:61)<br>
> at<br>
> io.undertow.server.handlers.<wbr>proxy.ProxyConnectionPool$2.<wbr>completed(ProxyConnectionPool.<wbr>java:286)<br>
> at<br>
> io.undertow.server.handlers.<wbr>proxy.ProxyConnectionPool$2.<wbr>completed(ProxyConnectionPool.<wbr>java:273)<br>
> at<br>
> io.undertow.client.http.<wbr>HttpClientProvider.<wbr>handleConnected(<wbr>HttpClientProvider.java:156)<br>
> at<br>
> io.undertow.client.http.<wbr>HttpClientProvider.access$000(<wbr>HttpClientProvider.java:51)<br>
> at<br>
> io.undertow.client.http.<wbr>HttpClientProvider$2.<wbr>handleEvent(<wbr>HttpClientProvider.java:127)<br>
> at<br>
> io.undertow.client.http.<wbr>HttpClientProvider$2.<wbr>handleEvent(<wbr>HttpClientProvider.java:124)<br>
> at org.xnio.ChannelListeners.<wbr>invokeChannelListener(<wbr>ChannelListeners.java:92)<br>
> at<br>
> org.xnio.nio.WorkerThread$<wbr>ConnectHandle.handleReady(<wbr>WorkerThread.java:326)<br>
> at org.xnio.nio.WorkerThread.run(<wbr>WorkerThread.java:561)<br>
> 14:05:03.462 [XNIO-1 I/O-1] ERROR io.undertow.proxy handleFailure -<br>
> UT005028: Proxy request to /v1/postData failed<br>
> java.io.IOException: UT001000: Connection closed<br>
> at<br>
> io.undertow.client.http.<wbr>HttpClientConnection$<wbr>ClientReadListener.<wbr>handleEvent(<wbr>HttpClientConnection.java:573)<br>
> at<br>
> io.undertow.client.http.<wbr>HttpClientConnection$<wbr>ClientReadListener.<wbr>handleEvent(<wbr>HttpClientConnection.java:511)<br>
> at org.xnio.ChannelListeners.<wbr>invokeChannelListener(<wbr>ChannelListeners.java:92)<br>
> at<br>
> org.xnio.conduits.<wbr>ReadReadyHandler$<wbr>ChannelListenerHandler.<wbr>readReady(ReadReadyHandler.<wbr>java:66)<br>
> at org.xnio.nio.NioSocketConduit.<wbr>handleReady(NioSocketConduit.<wbr>java:88)<br>
> at org.xnio.nio.WorkerThread.run(<wbr>WorkerThread.java:561)<br>
><br>
><br>
><br>
</div></div>> ______________________________<wbr>_________________<br>
> undertow-dev mailing list<br>
> <a href="mailto:undertow-dev@lists.jboss.org">undertow-dev@lists.jboss.org</a><br>
> <a href="https://lists.jboss.org/mailman/listinfo/undertow-dev" rel="noreferrer" target="_blank">https://lists.jboss.org/<wbr>mailman/listinfo/undertow-dev</a><br>
</blockquote></div><br></div>