Set "option forwardfor" by default for haproxy-route backends#550
Open
Copilot wants to merge 11 commits into
Open
Set "option forwardfor" by default for haproxy-route backends#550Copilot wants to merge 11 commits into
Copilot wants to merge 11 commits into
Conversation
Copilot
AI
changed the title
[WIP] Update j2 template to set option forwardfor by default for backends
Set "option forwardfor" by default for haproxy-route backends
Jun 12, 2026
…points
When haproxy processes a relation-changed event it calls publish_proxied_endpoints
for every valid TCP/HTTP frontend relation, not just the one that changed.
Any relation-set call — even writing the same value — triggers a relation-changed
on the requirer side (Juju tracks writes, not diffs). This creates an infinite loop:
requirer writes → haproxy relation-changed
→ haproxy re-publishes to ALL relations (unchanged data)
→ requirer relation-changed for each
→ requirer re-publishes to all → ∞
Fix: compare current provider databag to the intended write before calling
dump(). Skip if the endpoints are already identical.
Reproduces: canonical/maas-charms#627
…xied_endpoints" This reverts commit ef00c2e.
seb4stien
approved these changes
Jun 12, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this PR does
Adds
option forwardforto every HTTP backend in thehaproxy_route.cfg.j2template. This causes HAProxy to set theX-Forwarded-Forheader on all proxied requests, allowing backend applications to identify the original client IP.Why we need it
Without this option, backend services behind haproxy-route have no way to determine the real client IP address — they only see the HAProxy instance IP. The legacy configuration already sets this option; this brings haproxy-route to parity.
Test plan
test_protocol_httpsunit test to verifyoption forwardforis present in the rendered configuration.test_haproxy_route_options.pycontinue to pass.Review focus
option forwardforas the first directive after thebackendline — consistent with how the legacy code appends it.Checklist
docs/changelog.mdwith user-relevant changesdocs/release-notes/artifacts. If no change artifact is necessary, I tagged the PR with the labelno-release-note.(e.g., in
.github/workflows/integration_tests.yaml, ensure themoduleslist is correct)terraform fmtpasses andtflintreports no errors