Skip to content

Conversation

@phlax
Copy link
Member

@phlax phlax commented Feb 3, 2026

No description provided.

@phlax phlax force-pushed the example-http-filter-cc branch 19 times, most recently from 81b7d03 to e1a1fd4 Compare February 3, 2026 19:39
@phlax phlax changed the title examples: Add http-filter-cc using bzlmod [WIP] examples: Add http-filter-cc using bzlmod Feb 3, 2026
@phlax phlax marked this pull request as draft February 3, 2026 19:48
namespace Envoy {
namespace Http {

class HttpSampleDecoderFilterConfig {

Choose a reason for hiding this comment

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

If the purpose is to act as an example, I would split FilterConfig out into a separate .h and .cc file (this isn't common in other filter implementations, but it is clearer and makes pieces easier to find - I think the main reason it isn't common is that everyone is cargo-cult-copying from existing examples), and put everything in a namespace more similar to the namespaces other HTTP filters do. (Envoy / Extensions / HttpFilters / Sample)

Comment on lines +11 to +12
namespace Server {
namespace Configuration {

Choose a reason for hiding this comment

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

This should be the same namespace as the rest of the filter, and just do using Server::Configuration::NamedHttpFilterConfigFactory etc.

But also, don't use NamedHttpFilterConfigFactory, use Extensions::HttpFilters::Common::DualFactoryBase, and override createFilterFactoryFromProtoTyped and createRouteSpecificFilterConfigTyped, and use resolveMostSpecificPerFilterConfig in the filter, to provide a really good example. Maybe also register a factory for running the filter as an upstream filter.

}
};

static Registry::RegisterFactory<HttpSampleDecoderFilterConfigFactory, NamedHttpFilterConfigFactory>

Choose a reason for hiding this comment

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

I think the preferred form for this is

REGISTER_FACTORY(HttpSampleDecoderFilterConfigFactory, Server::Configuration::NamedHttpFilterConfigFactory);

(Even if you're using DualFactoryBase it's still NamedHttpFilterConfigFactory)

@phlax phlax force-pushed the example-http-filter-cc branch 4 times, most recently from 23edfa9 to 5367dbb Compare February 4, 2026 09:35
Copilot AI added a commit that referenced this pull request Feb 4, 2026
Co-authored-by: phlax <454682+phlax@users.noreply.github.com>
@phlax phlax force-pushed the example-http-filter-cc branch 8 times, most recently from be6ccdb to 9a2a4f9 Compare February 4, 2026 13:08
Signed-off-by: Ryan Northey <ryan@synca.io>
@phlax phlax force-pushed the example-http-filter-cc branch from 9a2a4f9 to d39e010 Compare February 4, 2026 13:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants