(Search) Enable gzip compression of responses

This commit is contained in:
Viktor Lofgren 2025-01-01 18:34:42 +01:00
parent 236f033bc9
commit 8b05c788fd

View File

@ -112,6 +112,13 @@ public class JoobyService {
var options = new ServerOptions();
options.setHost(config.bindAddress());
options.setPort(restEndpoint.port());
// Enable gzip compression of response data, but set compression to the lowest level
// since it doesn't really save much more space to dial it up. It's typically a
// single digit percentage difference since HTML already compresses very well with level = 1.
options.setCompressionLevel(1);
jooby.setServerOptions(options);
jooby.get("/internal/ping", ctx -> "pong");