[undertow-dev] Reverse-Proxy: Consuming InputStream before delegating to proxy target
Jaeckle Thomas (INST/ECS1)
Thomas.Jaeckle at bosch-si.com
Wed Jan 20 04:48:49 EST 2016
Hi.
I have following scenario in which I currently face a problem with Undertow:
I use Undertow as a Reverse-Proxy (via SimpleProxyClientProvider).
I want to enable a Signature-based authentication where the client can sign the HTTP request with its private key and the Reverse-Proxy (implemented with Undertow) can check with the client's public key if it was signed correctly.
I do not only want to include HTTP headers (Host, Date, ..) and Method/Path, but also the request body.
For that I need to consume the HttpServerExchange's InputStream:
if (isHttpMethodWithBody(method))
{
exchange.startBlocking();
final String body = new Scanner(exchange.getInputStream(), "UTF-8").useDelimiter("\\A<file:///\\A>").next();
..
Unfortunately in this scenario, the Exchange's "getRequestChannel()" returns null as "another party already acquired the channel".
I found "Connectors.resetRequestChannel(exchange)";
But just calling this results after the InputStream was consumed results in a "IOException : UT001000: Connection closed".
Is there any way to "consume" the request's payload, but afterwards simply forward to the proxy target?
Any help is really appreciated, Thanks!
--
Thomas Jäckle
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/undertow-dev/attachments/20160120/d2bccf43/attachment.html
More information about the undertow-dev
mailing list