Skip to content

Allow prioritization of Brotli compression over Gzip #13987

@iplasota

Description

@iplasota

Description:

Currently, NGINX Ingress supports both Brotli and Gzip compression, but there’s no straightforward way to configure Brotli as the preferred encoding when both are enabled.

Since modern browsers and clients widely support Brotli and it generally provides better compression ratios than Gzip, it would be beneficial to allow users to configure NGINX Ingress so that:

  • Brotli is prioritized when the client advertises support for both Brotli and Gzip.
  • Gzip is only used as a fallback when Brotli is not supported by the client.

Proposed solution:

  • Introduce a configuration option that allows explicitly prioritizing Brotli over Gzip in the Content-Encoding negotiation.
  • Ensure backward compatibility so that users who prefer Gzip first (or only Gzip) can still configure it that way.

Use case / Motivation:

  • Brotli offers significantly smaller responses for text-based resources (HTML, CSS, JS), reducing bandwidth and improving load times.
  • Many modern CDNs and reverse proxies already prioritize Brotli when available, so aligning with that behavior would improve consistency.
  • Having this option would give operators more control over performance optimizations.

Example config:

data:
  enable-brotli: "true"
  enable-gzip: "true"
  compression-priority: "brotli,gzip"

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/featureCategorizes issue or PR as related to a new feature.needs-priorityneeds-triageIndicates an issue or PR lacks a `triage/foo` label and requires one.

    Type

    No type

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions