5

To use undertow as a proxy server, which tracks all traffic (required for debugging purposes), I'm currently using a snippet like this:

Undertow.builder()
    .addHttpListener(8080, null)
    .setHandler(
        Handlers.requestDump(
            Handlers.proxyHandler(new SimpleProxyClientProvider(targeUri))
        )
    )
.build().start();

This already dumps all request and response headers. What I am searching for is a way to dump the request and response bodies, too. Any ideas of how to achieve that in combination with the ProxyHandler?

1 Answers1

0

As far as I know, there is no easy way for dumping request and response bodies, you need to implement a handler yourself.
There is a light-weight framework which contains this functionality to dump request and response bodies, you can take a look at it as a reference or use it. light-4j cross-cutting concerns, this contains the dump feature, but you need to consider how to inject to your code or write your own.
But to dump response may cause some performance issue, I suggest to use it carefully.

Balloon Wen
  • 61
  • 1
  • 2