Tue, 24 Dec 2024

12:22 PM - Micronaut Server Compression

Micronaut 3.9.4 does not support disabling compression in HTTP server responses.  There is a workaround though.  

Create a CustomHttpCompressionStrategy bean

@Primary
@Singleton
public class CustomHttpCompressionStrategy implements HttpCompressionStrategy {
public boolean shouldCompress(io.netty.handler.codec.http.HttpResponse response) { 
return false;
} 

public int getCompressionLevel() {

return 0;
}
}

0 comments