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 <sdouglas(a)redhat.com> 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 <stevehu(a)gmail.com> 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(a)lists.jboss.org
>
https://lists.jboss.org/mailman/listinfo/undertow-dev