Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for Brotli #9387

Merged
merged 16 commits into from
Nov 15, 2022
Merged

Add support for Brotli #9387

merged 16 commits into from
Nov 15, 2022

Conversation

glinton
Copy link
Contributor

@glinton glinton commented Sep 29, 2022

Hackaethon (Hackathon) entry

What does this PR do?

This PR adds support for the Brotli compression algorithm to Traefik.

Some breaking changes:

  • a new functionality is that if a request's Accept-Encoding header is set to *, a compressed response will now be sent, instead of the previous non-compressed response. Brotli is used when * is set because the gzip library used seems to ignore it.

  • Also, 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.

Fixes #4202

Motivation

This was a suggested issue for the Traefik Proxy 3.0 Hackaethon. It looked achievable with my schedule.

More

  • Added/updated tests
  • Added/updated documentation

Additional Notes

Co-authored-by: Mathieu Lonjaret mathieu.lonjaret@gmail.com
Co-authored-by: Tom Moulard tom.moulard@traefik.io
Co-authored-by: Romain rtribotte@users.noreply.github.com
Co-authored-by: Kevin Pollet pollet.kevin@gmail.com

@tomMoulard tomMoulard added this to To review in v2 via automation Sep 29, 2022
@tomMoulard tomMoulard modified the milestone: next Sep 29, 2022
@ldez ldez changed the title feat(compression): add support for Brotli feat: add support for Brotli Oct 17, 2022
Copy link

@botanegg botanegg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably middleware should be configurable to select set of compression algos

pkg/middlewares/compress/compress_test.go Outdated Show resolved Hide resolved
pkg/middlewares/compress/brotli/brotli_test.go Outdated Show resolved Hide resolved
pkg/middlewares/compress/brotli/brotli_test.go Outdated Show resolved Hide resolved
@kevinpollet kevinpollet added this to the next milestone Nov 8, 2022
@kevinpollet kevinpollet changed the title feat: add support for Brotli Add support for Brotli Nov 8, 2022
Copy link
Member

@tomMoulard tomMoulard left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👌

Copy link
Member

@kevinpollet kevinpollet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Co-authored-by: mpl <mathieu.lonjaret@gmail.com>
@traefiker traefiker merged commit 67d9c8d into traefik:master Nov 15, 2022
v2 automation moved this from To review to Done Nov 15, 2022
@sr-verde
Copy link

Thank you so much!

@tomeronen
Copy link

Thank you!

@martinbabic
Copy link

Can someone help as to how can I turn on brotli (possibly within docker-compose config)? Powered up v 2.9.5 in docker image but not sure how to go about replacing gzip with brotli compression?

@ldez
Copy link
Contributor

ldez commented Nov 20, 2022

Hello @martinbabic,

The milestone of this PR is next, which means this PR has been merged on the main/dev branch.
Brotli will be available in the next version of Traefik (v3.0).
But you can try the feature by using the experimental/unstable Docker image: traefik:experimental.
The documentation is here: https://doc.traefik.io/traefik/master/middlewares/http/compress/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
v2
Done
Development

Successfully merging this pull request may close these issues.

Brotli Support