Skip to content

Commit

Permalink
Enable gzip transfer encoding
Browse files Browse the repository at this point in the history
  • Loading branch information
josemduarte committed Sep 13, 2024
1 parent 0c5f1af commit d0d28ff
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import io.undertow.server.HttpServerExchange;
import io.undertow.server.RoutingHandler;
import io.undertow.server.handlers.BlockingHandler;
import io.undertow.server.handlers.encoding.EncodingHandler;
import io.undertow.util.AttachmentKey;
import io.undertow.util.Headers;
import org.rcsb.idmapper.IdMapperServer;
Expand Down Expand Up @@ -52,9 +53,14 @@ public UndertowFrontendImpl(BackendImpl backend, int port, Gson m) {
}

public void initialize() {
// wrap it in an encodingHandler for gzip-encoded transfer support, see https://stackoverflow.com/a/46836820
HttpHandler encodingHandler = new EncodingHandler.Builder().build(null)
.wrap(rootHandler);

this.server = Undertow.builder()
.setServerOption(UndertowOptions.ENABLE_HTTP2, true)
.addHttpListener(port, "0.0.0.0", rootHandler)
.addHttpListener(port, "0.0.0.0")
.setHandler(encodingHandler)
.build();
}

Expand Down

0 comments on commit d0d28ff

Please sign in to comment.