Skip to content

feat: add support for CDN real host self-binding in backend requests#144

Merged
ruslanti merged 3 commits into
mainfrom
feat/cdn-resource-self-binding-to-fastedge-app
Jun 4, 2026
Merged

feat: add support for CDN real host self-binding in backend requests#144
ruslanti merged 3 commits into
mainfrom
feat/cdn-resource-self-binding-to-fastedge-app

Conversation

@ruslanti
Copy link
Copy Markdown
Collaborator

@ruslanti ruslanti commented Jun 4, 2026

No description provided.

@ruslanti ruslanti self-assigned this Jun 4, 2026
Copilot AI review requested due to automatic review settings June 4, 2026 06:54
@ruslanti ruslanti added the enhancement New feature or request label Jun 4, 2026
@ruslanti ruslanti force-pushed the feat/cdn-resource-self-binding-to-fastedge-app branch from 77cb6a2 to 3becf7e Compare June 4, 2026 06:58
Copy link
Copy Markdown
Contributor

Copilot AI left a 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 “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-host from 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) and http-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 thread crates/http-service/src/state.rs
Comment thread crates/http-service/src/state.rs
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)
});
Comment thread crates/http-backend/src/lib.rs
Comment thread crates/http-backend/src/lib.rs
@ruslanti ruslanti force-pushed the feat/cdn-resource-self-binding-to-fastedge-app branch from f00813c to e13b8ac Compare June 4, 2026 08:12
@ruslanti ruslanti requested a review from Copilot June 4, 2026 10:09
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.

Comment thread crates/http-service/src/state.rs Outdated
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)
});
@ruslanti ruslanti requested a review from qrdl June 4, 2026 11:34
@ruslanti ruslanti force-pushed the feat/cdn-resource-self-binding-to-fastedge-app branch from 063fe04 to 255d407 Compare June 4, 2026 11:35
@ruslanti ruslanti merged commit 3d07fc9 into main Jun 4, 2026
4 of 6 checks passed
@ruslanti ruslanti deleted the feat/cdn-resource-self-binding-to-fastedge-app branch June 4, 2026 12:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants