Skip to content

Conversation

agrawroh
Copy link
Member

Description

We have a requirement to select GZip vs. Brotli on some specific routes. In this PR, we are adding support for per-route compressor library override in the compressor filter. With this change, routes would be able to specify a different compressor library (e.g., gzip, brotli) via the compressor_library field on a per-route basis.

This would allow different routes to use different compression algorithms and settings while maintaining the same filter configuration.


Commit Message: compressor: expose compressor_library for per-route overrides
Additional Description: Added support to allow different routes to use different compression algorithms and settings while maintaining the same filter configuration.
Risk Level: Low
Testing: Added Unit + Integration Tests
Docs Changes: Added
Release Notes: Added

Copy link

As a reminder, PRs marked as draft will not be automatically assigned reviewers,
or be handled by maintainer-oncall triage.

Please mark your PR as ready when you want it to be reviewed!

🐱

Caused by: #41177 was opened by agrawroh.

see: more, trace.

Copy link

CC @envoyproxy/api-shepherds: Your approval is needed for changes made to (api/envoy/|docs/root/api-docs/).
envoyproxy/api-shepherds assignee is @abeyad
CC @envoyproxy/api-watchers: FYI only for changes made to (api/envoy/|docs/root/api-docs/).

🐱

Caused by: #41177 was opened by agrawroh.

see: more, trace.

@agrawroh agrawroh force-pushed the feat-compressor branch 2 times, most recently from d6b7121 to 946d93b Compare September 23, 2025 00:39
@agrawroh agrawroh marked this pull request as ready for review September 23, 2025 01:49
Copy link
Contributor

@abeyad abeyad left a comment

Choose a reason for hiding this comment

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

/lgtm api

Copy link
Member

@wbpcode wbpcode left a comment

Choose a reason for hiding this comment

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

Thanks for the contribution. One high level comment to start the work :)

Comment on lines 727 to 737
Envoy::Compression::Compressor::CompressorFactory& CompressorFilter::getCompressorFactory() const {
const auto* per_route_config =
Http::Utility::resolveMostSpecificPerFilterConfig<CompressorPerRouteFilterConfig>(
decoder_callbacks_);
if (per_route_config && per_route_config->compressorFactory()) {
return const_cast<Envoy::Compression::Compressor::CompressorFactory&>(
*per_route_config->compressorFactory());
}
return const_cast<Envoy::Compression::Compressor::CompressorFactory&>(
config_->compressorFactory());
}
Copy link
Member

Choose a reason for hiding this comment

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

Please create a field in the filter to store the route level config and ensure the field could be initialized only once. Note, the route config maybe changed because the route refreshment. Keeping the route level config in filter could avoid the potential inconsistence.

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants