Skip to content

Add support for HTTP header regex replacement - #224

Merged
xosk31 merged 1 commit into
six-group:mainfrom
kenichi-mashiyama:add-support-for-http-header-regex-replacement
Sep 1, 2026
Merged

Add support for HTTP header regex replacement#224
xosk31 merged 1 commit into
six-group:mainfrom
kenichi-mashiyama:add-support-for-http-header-regex-replacement

Conversation

@kenichi-mashiyama

Copy link
Copy Markdown
Contributor

Summary

This PR adds support for replacing HTTP header values using regular expressions (http-request replace-value) in the HTTPRequestRules across frontends, backends, and listens.

Motivation

Currently, the HAProxy Operator supports setting and deleting HTTP headers, but it lacks the ability to modify existing header values using regular expressions (the native http-request replace-value directive in HAProxy). By introducing the replaceValue field, users can now dynamically rewrite specific parts of HTTP header values based on regex matches directly through the CRDs.

Changes

  • Added the ReplaceValue struct and field to HTTPRequestRules in apis/config/v1alpha1/common_types.go.
  • Updated the Model() method for HTTP Request Rules to map the new field to the native HAProxy model (Type: "replace-value", along with HdrName, HdrMatch, and HdrFormat).
  • Added unit tests in listen_types_test.go to verify the correct generation of the http-request replace-value configuration.
  • Regenerated CRDs, DeepCopy methods, and API documentation to reflect the schema updates.

Checklist

  • Code changes implemented
  • Unit tests added/updated
  • Generated CRDs and API docs updated

@xosk31

xosk31 commented Sep 1, 2026

Copy link
Copy Markdown
Collaborator

Many thanks for your contribution

@xosk31
xosk31 merged commit b9c8458 into six-group:main Sep 1, 2026
4 checks passed
@kenichi-mashiyama
kenichi-mashiyama deleted the add-support-for-http-header-regex-replacement branch September 2, 2026 00:35
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