-
Notifications
You must be signed in to change notification settings - Fork 842
cookie_remap: disable_pristine_host_hdr #12631
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds a disable_pristine_host_hdr configuration option to the cookie_remap plugin. This allows the Host header to be updated to match the remapped destination when routing based on cookie values, which is useful for downstream routing decisions in production environments where pristine host headers are normally preserved.
- Added
disable_pristine_host_hdrconfiguration parameter to control Host header behavior on the sendto path - Modified the operation processing to track whether the sendto or else path was taken and conditionally disable pristine host headers
- Comprehensive test coverage with two test scenarios (enabled/disabled) and associated replay files
Reviewed Changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| plugins/experimental/cookie_remap/cookie_remap.cc | Implements the disable_pristine_host_hdr feature with getter/setter methods, configuration parsing, and logic to disable pristine host headers on the sendto path |
| tests/gold_tests/pluginTest/cookie_remap/disable_pristine_host_hdr.test.py | Test class that validates the feature with both enabled and disabled configurations |
| tests/gold_tests/pluginTest/cookie_remap/disable_pristine_host_hdr_true.replay.yaml | Replay file verifying Host header updates when feature is enabled |
| tests/gold_tests/pluginTest/cookie_remap/disable_pristine_host_hdr_false.replay.yaml | Replay file verifying Host header preservation when feature is disabled |
| tests/gold_tests/pluginTest/cookie_remap/configs/disable_pristine_host_hdr_config_true.txt | Configuration file with disable_pristine_host_hdr set to true |
| tests/gold_tests/pluginTest/cookie_remap/configs/disable_pristine_host_hdr_config_false.txt | Configuration file with disable_pristine_host_hdr not set (default behavior) |
| doc/admin-guide/plugins/cookie_remap.en.rst | Documentation for the new configuration option with detailed examples |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
tests/gold_tests/pluginTest/cookie_remap/disable_pristine_host_hdr.test.py
Outdated
Show resolved
Hide resolved
tests/gold_tests/pluginTest/cookie_remap/configs/disable_pristine_host_hdr_config_false.txt
Outdated
Show resolved
Hide resolved
|
I reviewed this, and it looks good. It seems Github Copilot found some typos etc. that should be addressed. For fun, I also ran this PR through Claude, and it produces this ... PR #12631 Review: Add
|
This adds an optional disable_pristine_host_hdr configuration parameter to cookie_remap that, when enabled, disables the proxy.config.url_remap.pristine_host_hdr setting for matched transactions. This allows the Host header to be updated to match the hostname in the sendto URL, which is useful when downstream routing (such as parent proxies or origin server selection) depends on the Host header value. The feature is off by default to preserve backward compatibility and only affects the sendto path, while the else path continues to use the configured pristine host header setting.
e6692b2 to
3f5f0fb
Compare
Sounds good. Thank you @zwoop. I updated the comment typos. |
This adds an optional disable_pristine_host_hdr configuration parameter to cookie_remap that, when enabled, disables the
proxy.config.url_remap.pristine_host_hdr setting for matched transactions. This allows the Host header to be updated to match the hostname in the sendto URL, which is useful when downstream routing (such as parent proxies or origin server selection) depends on the Host header value. The feature is off by default to preserve backward compatibility and only affects the sendto path, while the else path continues to use the configured pristine host header setting.