envoyproxy/envoy-filter-example

Example of consuming Envoy and adding a custom filter

360

stars

5,271

commits

C++

primary language

Apr 14, 2025

updated

README

Envoy filter example

This project demonstrates the linking of additional filters with the Envoy binary. A new filter echo2 is introduced, identical modulo renaming to the existing echo filter. Integration tests demonstrating the filter's end-to-end behavior are also provided.

For an example of additional HTTP filters, see here.

OpenSSF Scorecard

Building

To build the Envoy static binary:

  1. git submodule update --init
  2. bazel build //:envoy

Testing

To run the echo2 integration test:

bazel test //:echo2_integration_test

To run the regular Envoy tests from this project:

bazel test @envoy//test/...

How it works

The Envoy repository is provided as a submodule. The WORKSPACE file maps the @envoy repository to this local path.

The BUILD file introduces a new Envoy static binary target, envoy, that links together the new filter and @envoy//source/exe:envoy_main_entry_lib. The echo2 filter registers itself during the static initialization phase of the Envoy binary as a new filter.

Contributors

(top 30 of 40)

update-envoy[bot]

5,187 commits

htuch

10 commits

phlax

9 commits

alyssawilk

7 commits

envoyproxy/envoy-filter-example

Example of consuming Envoy and adding a custom filter

360

stars

5,271

commits

C++

primary language

Apr 14, 2025

updated

README

Envoy filter example

This project demonstrates the linking of additional filters with the Envoy binary. A new filter echo2 is introduced, identical modulo renaming to the existing echo filter. Integration tests demonstrating the filter's end-to-end behavior are also provided.

For an example of additional HTTP filters, see here.

OpenSSF Scorecard

Building

To build the Envoy static binary:

  1. git submodule update --init
  2. bazel build //:envoy

Testing

To run the echo2 integration test:

bazel test //:echo2_integration_test

To run the regular Envoy tests from this project:

bazel test @envoy//test/...

How it works

The Envoy repository is provided as a submodule. The WORKSPACE file maps the @envoy repository to this local path.

The BUILD file introduces a new Envoy static binary target, envoy, that links together the new filter and @envoy//source/exe:envoy_main_entry_lib. The echo2 filter registers itself during the static initialization phase of the Envoy binary as a new filter.

Contributors

(top 30 of 40)

update-envoy[bot]

5,187 commits

htuch

10 commits

phlax

9 commits

alyssawilk

7 commits

Languages

C++

67.5%

Starlark

21.7%

Shell

10.8%