Skip to content
This repository has been archived by the owner on Mar 20, 2021. It is now read-only.

Enabling http2 stops gzip compression #1993

Closed
rroller opened this issue Jan 21, 2018 · 1 comment
Closed

Enabling http2 stops gzip compression #1993

rroller opened this issue Jan 21, 2018 · 1 comment

Comments

@rroller
Copy link

rroller 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;
@glassfishrobot
Copy link

Closing this as this issue is migrated to eclipse-ee4j/grizzly#1993

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

No branches or pull requests

2 participants