diff --git a/src/main/java/org/rcsb/idmapper/frontend/UndertowFrontendImpl.java b/src/main/java/org/rcsb/idmapper/frontend/UndertowFrontendImpl.java index dc56fe4..02d67da 100644 --- a/src/main/java/org/rcsb/idmapper/frontend/UndertowFrontendImpl.java +++ b/src/main/java/org/rcsb/idmapper/frontend/UndertowFrontendImpl.java @@ -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; @@ -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(); }