Gzip

    Sandbox environment

    Setup your sandbox environment with Docker and Docker Compose, and clone the Envoy repository with Git.

    Used to make requests.

    By enabling compression in Envoy you can save some network bandwidth, at the expense of increased processor usage.

    Envoy supports compression and decompression for both requests and responses.

    This sandbox provides an example of response compression served over HTTP. Although HTTPS is not demonstrated, compression can be used for this also.

    The sandbox covers two scenarios:

    • compression of files from an upstream server

    Change to the examples/gzip directory and bring up the docker composition.

    The sandbox is configured with two endpoints on port 10000 for serving upstream files:

    • /file.json

    Only is configured to be compressed.

    Use curl to check that the response from requesting file.json contains the content-encoding: gzip header.

    You will need to add an accept-encoding: gzip request header.

    As only files with a content-type of application/json are configured to be gzipped, the response from requesting file.txt should not contain the header, and the file will not be compressed:

    The sandbox is configured with two ports serving Envoy’s admin and statistics interface:

    Use curl to make a request for uncompressed statistics on port 9901, it should not contain the content-encoding header in the response:

    Now, use curl to make a request for the compressed statistics:

    See also

    Gzip API

    API and configuration reference for Envoy’s gzip compression.

    Reference documentation for Envoy’s compressor filter.

    Envoy admin quick start guide