Compress

    1. apiVersion: traefik.containo.us/v1alpha1
    2. kind: Middleware
    3. metadata:
    4. name: test-compress
    5. spec:
    6. compress: {}
    1. # Enable gzip compression
    2. - "traefik.http.middlewares.test-compress.compress=true"
    1. "traefik.http.middlewares.test-compress.compress": "true"
    2. }
    1. # Enable gzip compression
    2. [http.middlewares.test-compress.compress]
    1. # Enable gzip compression
    2. http:
    3. middlewares:
    4. test-compress:
    5. compress: {}

    Info

    • The response body is larger than 1400 bytes.
    • The Accept-Encoding request header contains gzip.

    Configuration Options

    excludedContentTypes specifies a list of content types to compare the Content-Type header of the incoming requests to before compressing.

    Content types are compared in a case-insensitive, whitespace-ignored manner.

    1. labels:
    2. - "traefik.http.middlewares.test-compress.compress.excludedcontenttypes=text/event-stream"
    1. - "traefik.http.middlewares.test-compress.compress.excludedcontenttypes=text/event-stream"
    1. "labels": {
    2. "traefik.http.middlewares.test-compress.compress.excludedcontenttypes": "text/event-stream"
    3. }
    1. labels:
    2. - "traefik.http.middlewares.test-compress.compress.excludedcontenttypes=text/event-stream"
    1. http:
    2. middlewares:
    3. test-compress:
    4. compress:
    5. - text/event-stream