mesosphere / chaos

A lightweight framework for writing REST services in Scala.
Apache License 2.0
250 stars 36 forks source link

Serve Gzipped assets if they exist #7

Closed ssorallen closed 7 years ago

ssorallen commented 10 years ago

If a client requests an asset with Accept-Encoding: gzip, Chaos should serve a gzipped version of the asset if one exists. Right now Chaos ignores the heading and always serves the uncompressed version.

It appears that Jetty supports serving gzipped assets by calling ResourceHandler.setMinGzipLength with a value greater than 0. "1" seems like a reasonable value since every other value is equally arbitrary.

This is where the change looks like it should happen: https://github.com/mesosphere/chaos/blob/3a0e435121a51d094923ae1750085d71e346a03b/src/main/scala/mesosphere/chaos/http/HttpModule.scala#L88

Edit: The above example was to the wrong "ResourceHandler". Jetty handles Gzip compression with its Gzip Filter.

ssorallen commented 10 years ago

Maybe this is better done by each application using Chaos by providing a "override-web.xml" config?

ssorallen commented 10 years ago

@ConnorDoyle Would it be possible for a client like Marathon to provide a jetty-web.xml that gets used by the Jetty server started by Chaos?

ssorallen commented 7 years ago

Very old issue. Closing.