<div dir="ltr"><div><span class="" style="white-space:pre">Hi all,</span></div><div><span class="" style="white-space:pre"><br></span></div><div><span class="" style="white-space:pre">I&#39;ve seem to have hit a bug in undertow when combining proxying and gzip.</span></div><div><span class="" style="white-space:pre"><br></span></div><div><span class="" style="white-space:pre">I&#39;m trying to use undertow as a reverse-proxy and also compressing the result when clients support it. Undertow-code below.</span></div><div><span class="" style="white-space:pre"><br></span></div><div><span class="" style="white-space:pre">* Proxying without compressing works fine (curl -v localhost:8099/proxy)</span></div><div><span style="white-space:pre">* Compressing content that is not proxied works fine (curl -v --compress</span><span style="white-space:pre"> </span><span style="white-space:pre">localhost:8099/local)</span></div><div><span style="white-space:pre">* Proxy and compression just hangs. Not even headers are received (</span><span style="white-space:pre">curl -v </span><span style="white-space:pre">--compress </span><span style="white-space:pre">localhost:8099/proxy)</span></div><div><span style="white-space:pre"><br></span></div><div><span style="white-space:pre">Trying to debug what&#39;s going on I found that the GzipStreamSinkConduit receives all content but is never flushed.</span></div><div><span style="white-space:pre"><br></span></div><div><span style="white-space:pre">The call sequence for </span><span style="white-space:pre">GzipStreamSinkConduit </span><span style="white-space:pre">for proxied content is:</span></div><div><span style="white-space:pre">write(ByteBuffer src) - all context from the proxied app is written.
</span>wakeupWrites() - which basically does nothing. Ends up in DeflatingStreamSinkConduit.queueWriteListener() which calls any WriteReadyHandlers but there are none.<br></div><div><br></div><div>Any clues?</div><div><span style="white-space:pre"><br></span></div><div><span class="" style="white-space:pre">My code to setup undertow:</span></div><div><span class="" style="white-space:pre"><br></span></div><div><div><span style="white-space:pre">final PathHandler pathHandler = Handlers.path();</span></div><div><span style="white-space:pre">pathHandler.addExactPath(&quot;/local&quot;, new HttpHandler() {</span></div><div><span class="" style="white-space:pre">        </span>@Override</div><div><span class="" style="white-space:pre">        </span>public void handleRequest(HttpServerExchange exchange) throws Exception {</div><div><span class="" style="white-space:pre">                </span>exchange.getResponseHeaders().put(Headers.CONTENT_TYPE, &quot;text/plain&quot;);</div><div><span class="" style="white-space:pre">                </span>exchange.getResponseSender().send(&quot;Hello World&quot;);<span class="" style="white-space:pre">                        </span>}</div><div><span style="white-space:pre">});</span></div><div><span style="white-space:pre">pathHandler.addPrefixPath(&quot;/proxy&quot;,</span></div><div><span class="" style="white-space:pre">                </span>new ProxyHandler(</div><div><span class="" style="white-space:pre">                                </span>new SimpleProxyClientProvider(new URI(&quot;<a href="http://localhost:8060/menu">http://localhost:8060/menu</a>&quot;)), ResponseCodeHandler.HANDLE_404));</div><div><span style="white-space:pre"><br></span></div><div><span style="white-space:pre">final EncodingHandler handler =</span></div><div><span class="" style="white-space:pre">        </span>new EncodingHandler(pathHandler, new ContentEncodingRepository()</div><div><span class="" style="white-space:pre">        </span>  .addEncodingHandler(&quot;gzip&quot;,</div><div><span class="" style="white-space:pre">                </span>  new GzipEncodingProvider(), 50,</div><div><span class="" style="white-space:pre">                                                </span>Predicates.truePredicate()));</div><div><span style="white-space:pre"><br></span></div><div><span style="white-space:pre">Undertow.builder()</span></div><div><span class="" style="white-space:pre">        </span>.addHttpListener(8099, &quot;0.0.0.0&quot;)</div><div><span class="" style="white-space:pre">        </span>.setHandler(handler)</div><div><span class="" style="white-space:pre">        </span>.build().start();</div></div><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr">Br,<div>Martin Andersson</div><div>Purple Scout AB</div><div>+46 732 05 14 01</div></div></div>
</div>