Skip to content

Automatically compress responses from Accept-Encoding #111

Open

Description

@aram356

Description

Provide automatic response compression negotiated from the client Accept-Encoding, without requiring applications to write or manually assemble compression middleware.

Main has gzip/Brotli decoding helpers, but no response encoder/negotiation middleware in the public core surface. PR #452 proposes explicit Fastly delivery-compression intent; applications still own reader negotiation/fallback, so it covers only part of this story.

Steps to reproduce

  1. Inspect the compression module and middleware module for an outgoing compression policy.
  2. Compare the scope of Add explicit adapter delivery compression support #452 with automatic, application-facing negotiation.

Expected behavior

An application can enable a supported automatic policy and receive an encoding acceptable to the client with consistent response metadata.

Impact

Applications currently implement negotiation and compression policy themselves, limiting portability and increasing integration work.

Proposed fix

Design a small configuration/adapter integration over supported encoders, including safe identity fallback, encoded-body preservation and streaming behavior. Reuse #452 where applicable without equating explicit intent with automatic negotiation.

Done when

  • Automatic selection honors supported Accept-Encoding values and quality/identity behavior.
  • Headers such as Content-Encoding, length and Vary match the emitted bytes, including already encoded responses.
  • Bodyless/otherwise ineligible responses are handled correctly and streaming behavior is documented.
  • An example enables the behavior without custom compression middleware code.

Related

Activity

  1. changed the title [-]As a developer I want automatic response compression[/-] [+]Automatically compress responses from Accept-Encoding[/+] on Nov 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions