Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enabling http2 stops gzip compression #1993

Open
arinban opened this issue Jan 21, 2018 · 1 comment
Open

Enabling http2 stops gzip compression #1993

arinban opened this issue Jan 21, 2018 · 1 comment

Comments

@arinban
Copy link

arinban commented Jan 21, 2018

When I enabled http2, content is no longer gzip compressed.

Versions: 2.4.3

Here's an example configuation...

final WebappContext context = new WebappContext("myservice", "");
final boolean start = false;

// Create the server
final HttpServer server = GrizzlyHttpServerFactory.createHttpServer(BASE_URI, start);
final NetworkListener listener = server.getListeners().iterator().next();

// Configure SSL
final SSLEngineConfigurator sslConfig = getSslConfig(config);
listener.setSecure(true);
listener.setSSLEngineConfig(sslConfig);

// Create default HTTP/2 configuration and provide it to the AddOn
final Http2Configuration configuration = Http2Configuration.builder().build();
final Http2AddOn http2Addon = new Http2AddOn(configuration);
listener.registerAddOn(http2Addon); // This will break gzip

...

// Gzip compression
final CompressionConfig compression = listener.getCompressionConfig();
compression.setCompressionMode(CompressionConfig.CompressionMode.ON);
compression.setCompressionMinSize(1);
compression.setCompressibleMimeTypes(ImmutableSet.<String> builder()
.add("text/plain")
.add("text/html")
.add("text/css")
.add("text/javascript")
.build());

context.deploy(server);

return server;
@arinban
Copy link
Author

arinban commented Feb 3, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant