Skip to content

Instantly share code, notes, and snippets.

@fatihyildizhan
Last active October 4, 2023 13:51
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fatihyildizhan/e1d9d909049f0a67a7d1585468193438 to your computer and use it in GitHub Desktop.
Save fatihyildizhan/e1d9d909049f0a67a7d1585468193438 to your computer and use it in GitHub Desktop.
Traefik v2 - How to enable gzip compression
### Traefik v2 docker-compose.yml
version: '3.7'
services:
traefik:
image: traefik:v2.2.7
container_name: traefik
labels:
.
.
.
// paste on the last line to enable gzip compression
- "traefik.http.routers.traefik.middlewares=traefik-compress"
- "traefik.http.middlewares.traefik-compress.compress=true"
### Your container docker-compose.yml
version: '3.7'
services:
your_service_name:
image: your_image_url
container_name: your_container_name
labels:
.
.
.
// paste on the last line to enable gzip compression
- "traefik.http.middlewares.your_container_name_compress.compress=true"
- "traefik.http.routers.your_container_name.middlewares=your_container_name_compress"
@karolzlot
Copy link

in my case it was enough to add two labels to traefik service, no additional labels to other containers

@fatihyildizhan
Copy link
Author

@karolzlot Did you have any updates on your config file?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment