Skip to content

feat: redefine HTTP status codes and add internal status header #120

Merged
ruslanti merged 1 commit intomainfrom
feat/redefine-http-status-code-returned-by-fastedge-as-gcore-cdn-component
Mar 17, 2026
Merged

feat: redefine HTTP status codes and add internal status header #120
ruslanti merged 1 commit intomainfrom
feat/redefine-http-status-code-returned-by-fastedge-as-gcore-cdn-component

Conversation

@ruslanti
Copy link
Collaborator

No description provided.

Copy link
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 introduces a new internal failure classification mechanism by emitting an X-CDN-Internal-Status response header and documenting a 3000–3999 internal status code range to disambiguate runtime failure reasons behind existing 5xx status codes.

Changes:

  • Adds internal status code constants (3000–3999) and a new X-Cdn-Internal-Status header constant.
  • Extends error mapping to return an internal status code and attempts to attach it to error responses.
  • Updates executor HTTP tests and README documentation to cover/describe the new header.

Reviewed changes

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

File Description
crates/http-service/src/lib.rs Adds internal status constants and attempts to set X_CDN_INTERNAL_STATUS on error responses.
crates/http-service/src/executor/http.rs Updates tests to assert presence/value of the new internal status header for timeout/OOM.
README.md Documents internal status code meanings and the header contract.
Comments suppressed due to low confidence (1)

crates/http-service/src/lib.rs:365

  • Because app_res_headers(cfg) is folded into the response builder after X-CDN-Internal-Status is set, a configured app response header with the same name could append a second value and make the internal status ambiguous for downstream consumers. If X-CDN-Internal-Status is meant to be authoritative, set/overwrite it after applying app headers (or insert it into the built response’s HeaderMap with insert and optionally remove any existing values).
                let builder = hyper::Response::builder()
                    .status(status_code)
                    .header(X_CDN_INTERNAL_STATUS, internal_code);
                let res_headers = app_res_headers(cfg);
                let builder = res_headers
                    .iter()
                    .fold(builder, |builder, (k, v)| builder.header(k, v));


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@ruslanti ruslanti requested a review from qrdl March 17, 2026 12:39
@ruslanti ruslanti added the enhancement New feature or request label Mar 17, 2026
@ruslanti ruslanti marked this pull request as ready for review March 17, 2026 12:39
@ruslanti ruslanti merged commit 963237d into main Mar 17, 2026
5 of 7 checks passed
@ruslanti ruslanti deleted the feat/redefine-http-status-code-returned-by-fastedge-as-gcore-cdn-component branch March 17, 2026 13:05
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