feat: add support for CDN real host self-binding in backend requests#144
Merged
Merged
Conversation
77cb6a2 to
3becf7e
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds “CDN real host” self-binding support so that when an app makes an outbound backend request targeting the original end-user host (via X-Cdn-Real-Host) on a default port, the request is routed back to the local app (fastedge-hostname=localhost) while still exposing the real host through Fastedge_Header_Hostname.
Changes:
- Propagate
x-cdn-real-hostfrom inbound requests into backend request processing (both HTTP and WASI executors). - Implement self-binding routing-header rewrite logic in both
http-service(WASI backend request rewriting) andhttp-backend(connector-backed FastEdge strategy). - Add unit/integration tests covering self-binding behavior and the “ignore app Host header” case.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| crates/http-service/src/state.rs | Adds self-binding routing-header rewrite for WASI outbound backend requests and unit tests. |
| crates/http-service/src/executor/wasi_http.rs | Reads x-cdn-real-host from inbound headers and sets it on the backend instance. |
| crates/http-service/src/executor/mod.rs | Defines the X_CDN_REAL_HOST header constant. |
| crates/http-service/src/executor/http.rs | Reads x-cdn-real-host from inbound headers and sets it on the backend instance. |
| crates/http-backend/src/lib.rs | Adds backend-level cdn_real_host state + self-binding logic and tests for connector-backed requests. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+273
to
+277
| .is_some_and(|(cdn_real_host, url_host)| { | ||
| let port_ok = | ||
| matches!(original_url.port_u16(), None | Some(80) | Some(443)); | ||
| port_ok && cdn_real_host.eq_ignore_ascii_case(url_host) | ||
| }); |
f00813c to
e13b8ac
Compare
Comment on lines
91
to
95
| static FILTER_HEADERS: [HeaderName; 6] = [ | ||
| header::HOST, | ||
| header::CONTENT_LENGTH, | ||
| header::TRANSFER_ENCODING, | ||
| header::UPGRADE, |
Comment on lines
+81
to
+89
| let self_binding = self | ||
| .http_backend | ||
| .cdn_real_host() | ||
| .zip(original_url.host()) | ||
| .is_some_and(|(cdn_real_host, url_host)| { | ||
| let port_ok = | ||
| matches!(original_url.port_u16(), None | Some(80) | Some(443)); | ||
| port_ok && cdn_real_host.eq_ignore_ascii_case(url_host) | ||
| }); |
Comment on lines
+287
to
+295
| let self_binding = self | ||
| .cdn_real_host | ||
| .as_ref() | ||
| .zip(original_url.host()) | ||
| .is_some_and(|(cdn_real_host, url_host)| { | ||
| let port_ok = | ||
| matches!(original_url.port_u16(), None | Some(80) | Some(443)); | ||
| port_ok && cdn_real_host.eq_ignore_ascii_case(url_host) | ||
| }); |
…poofed header handling
063fe04 to
255d407
Compare
qrdl
approved these changes
Jun 4, 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.
No description provided.