Skip to content

v2 to v3 migration does not mention change in compression middleware behaviour #10311

@JasperJuergensen

Description

@JasperJuergensen

Welcome!

  • Yes, I've searched similar issues on GitHub and didn't find any.
  • Yes, I've searched similar issues on the Traefik community forum and didn't find any.

What did you do?

Treafik running with the compression middleware enabled for a route.

Making a request with a client without setting the Accept-Encoding header to that route. Traefik compresses the data using brotli (as mentioned in the documentation).

Even though the behaviour is technically correct on both sides, changing from v2 to v3 without having this in mind might cause problems (and there is nothing in the documentation hinting about that change except that the documentation for the different versions has been changed).

What did you see instead?

Traefik behaves as expected (and mentioned in the documentation). But neither the migration documentation (v2 to v3) nor the changelog mentions anything about that change (making it hard to debug if clients are having problems with this scenario).

Also the documentation change is pretty small, making it hard to detect it.

v2 behaviour (docs):

Responses are compressed when the following criteria are all met:

  • The response body is larger than the configured minimum amount of bytes (default is 1024).
  • The Accept-Encoding request header contains gzip.
  • The response is not already compressed, i.e. the Content-Encoding response header is not already set.

If the Content-Type header is not defined, or empty, the compress middleware will automatically detect a content type. It will also set the Content-Type header according to the detected MIME type.

v3 behaviour (docs):

Responses are compressed when the following criteria are all met:

  • The Accept-Encoding request header contains gzip, *, and/or br with or without quality values. If the Accept-Encoding request header is absent, it is meant as br compression is requested. If it is present, but its value is the empty string, then compression is disabled.
  • The response is not already compressed, i.e. the Content-Encoding response header is not already set.
  • The responseContent-Type header is not one among the excludedContentTypes options.
  • The response body is larger than the configured minimum amount of bytes (default is 1024).

Would be nice to have some information about this in the migration guide or at least in the changelog.

What version of Traefik are you using?

Version: 3.0.0-beta5
Codename: beaufort
Go version: go1.21.4
Built: 2023-11-29T15:14:06Z
OS/Arch: linux/amd64

What is your environment & configuration?

entryPoints:
  http:
    address: ':80'
http:
  middlewares:
    default-compress:
      compress: true
  services:
    openid-server:
      loadBalancer:
        servers:
          - url: 'http://localhost:8080'
  routers:
    openid-server:
      rule: Host(`openid-server.example.com`)
      entryPoints:
        - http
      service: openid-server
      middlewares:
        - default-compress

If applicable, please paste the log output in DEBUG level

No response

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions