Skip to content

WASM module that mutates the http request header based on configuration file.

Notifications You must be signed in to change notification settings

raffaelschneider/envoy-request-header-mutator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Envoy Request Header Mutator

Overview

This Rust-based project implements a custom filter for Envoy proxy using the proxy_wasm framework. It is designed to mutate HTTP request headers based on predefined configurations. Supported operations include adding, modifying, replacing, and removing headers.

Features

  • Add Headers: Add new headers to the HTTP request.
  • Modify Headers: Modify existing headers based on regex patterns.
  • Replace Headers: Replace the value of existing headers.
  • Remove Headers: Remove specified headers from the request.

Dependencies

  • proxy_wasm: Framework for building Envoy WASM filters.
  • serde: Serialization and deserialization framework.
  • regex: Regular expression library for header value manipulation.

Usage

  1. Configuration: Define your header mutation rules in the configuration. The configuration should be in JSON format, defining the type of operation (Add, Modify, Replace, Remove) and the relevant parameters.

  2. Build: Compile the project to generate a WASM binary.

  3. Deployment: Deploy the compiled WASM binary as an Envoy filter.

Example Configuration

{
  "type": "Modify",
  "header": "example-header",
  "regex": "original-value",
  "replace_with": "new-value"
}

This example configuration will modify example-header in the HTTP request, replacing original-value with new-value. Logging

The filter uses proxy_wasm::set_log_level(LogLevel::Trace) for detailed logging, which can be adjusted as needed. Contributing

Contributions to this project are welcome. Please submit issues and pull requests via GitHub.

License

About

WASM module that mutates the http request header based on configuration file.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages