Skip to content

feat(elbv2): honor preserve_host_header parameter - #2109

Open
jvdsande wants to merge 1 commit into
floci-io:mainfrom
jvdsande:feat/elb-preserve_host_header
Open

feat(elbv2): honor preserve_host_header parameter#2109
jvdsande wants to merge 1 commit into
floci-io:mainfrom
jvdsande:feat/elb-preserve_host_header

Conversation

@jvdsande

@jvdsande jvdsande commented Aug 3, 2026

Copy link
Copy Markdown

Summary

Hello!
This PR updates the ELBv2 service to honor the preserve_host_header parameter.

It propagates the load balancer's ARN through the ElbV2DataPlane instance in order to retrieve the current value of routing.http.preserve_host_header.enabled in executeForward/proxyRequest

Type of change

  • Bug fix (fix:)
  • New feature (feat:)
  • Breaking change (feat!: or fix!:)
  • Docs / chore

AWS Compatibility

Change tested with a simple echo server running on ECS behind an ALB.

Stack deployed through terraform with hashicorp/aws 6.57.1.

Without the patch/with preserve_host_header=false:

curl \                                               
  -H 'Host: example.com' \
  http://localhost:8088/
{"host":"172.17.0.3:8080"}

With the patch + preserve_host_header=true:

curl \
  -H 'Host: example.com' \
  http://localhost:8088/
{"host":"example.com"}

Checklist

  • ./mvnw test passes locally
  • New or updated integration test added
  • Commit messages follow Conventional Commits

@github-actions

github-actions Bot commented Aug 3, 2026

Copy link
Copy Markdown

🎉 Thanks for your first pull request to Floci!

Your CI checks need a maintainer to approve them before they run. That is GitHub's standard gate on first-time contributors, not a problem with your PR — so if the checks look like they are doing nothing, that is why. Once a maintainer approves, CI and the compatibility suite start automatically. Nothing is needed from you in the meantime.

While you wait, a couple of things that make review faster:

  • Link the issue this fixes with Closes #N in the description
  • Commits follow Conventional Commits (feat(s3): ..., fix(dynamodb): ...)
  • Behaviour changes come with a test — see CONTRIBUTING.md

Come join us in Slack — it is the fastest way to reach maintainers if you get stuck, or want feedback on an approach before investing more time in it.

@greptile-apps

greptile-apps Bot commented Aug 3, 2026

Copy link
Copy Markdown

Greptile Summary

The PR adds support for the ELBv2 routing.http.preserve_host_header.enabled attribute and verifies both its default and enabled behavior.

  • Propagates the listener and load-balancer identity through forward-action processing.
  • Reads the current load-balancer attribute for each forwarded request.
  • Preserves the inbound Host header when enabled and otherwise continues using the target authority.
  • Adds an end-to-end integration test covering runtime attribute changes.

Confidence Score: 5/5

The PR appears safe to merge, with the new host-header behavior covered through the real ELBv2 data-plane path.

The listener resolves its owning load balancer, each forward reads the current attribute value, and the integration test confirms both disabled and enabled behavior without exposing a concrete regression.

Important Files Changed

Filename Overview
src/main/java/io/github/hectorvent/floci/services/elbv2/ElbV2DataPlane.java Propagates listener ownership into forwarding and conditionally retains the inbound Host header based on the live load-balancer attribute.
src/test/java/io/github/hectorvent/floci/services/elbv2/ElbV2PreserveHostHeaderIntegrationTest.java Adds an integration test proving default target-host forwarding and immediate client-host preservation after enabling the attribute.

Sequence Diagram

sequenceDiagram
    participant Client
    participant DataPlane as ELBv2 Data Plane
    participant Service as ELBv2 Service
    participant Backend
    Client->>DataPlane: Request with original Host
    DataPlane->>Service: Read load-balancer attributes
    Service-->>DataPlane: preserve_host_header value
    alt Preservation enabled
        DataPlane->>Backend: Forward with original Host
    else Preservation disabled
        DataPlane->>Backend: Forward with target Host
    end
    Backend-->>DataPlane: Response
    DataPlane-->>Client: Proxied response
Loading

Reviews (1): Last reviewed commit: "feat(elbv2): honor preserve_host_header ..." | Re-trigger Greptile

@hectorvent hectorvent added enhancement New feature or request elb Elastic Load Balancing (ELBv2) labels Aug 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

elb Elastic Load Balancing (ELBv2) enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants