Skip to content

Handle oversized HEAD response metadata#951

Open
ChristianPavilonis wants to merge 2 commits into
mainfrom
fix/head-content-length-limit
Open

Handle oversized HEAD response metadata#951
ChristianPavilonis wants to merge 2 commits into
mainfrom
fix/head-content-length-limit

Conversation

@ChristianPavilonis

Copy link
Copy Markdown
Collaborator

Summary

  • Allow HEAD responses to preserve oversized Content-Length metadata without triggering the buffered-body safety limit.
  • Keep the existing 10 MiB limit intact for buffered responses that can allocate origin body bytes in WASM memory.

Changes

File Change
crates/trusted-server-adapter-fastly/src/platform.rs Track whether the request expects a response body, return an empty body for HEAD responses, and add oversized HEAD/GET regression coverage.

Closes

Closes #950

Test plan

  • cargo test-fastly && cargo test-axum
  • cargo clippy-fastly && cargo clippy-axum
  • cargo fmt --all -- --check
  • JS tests: cd crates/trusted-server-js/lib && npx vitest run
  • JS format: cd crates/trusted-server-js/lib && npm run format
  • Docs format: cd docs && npm run format
  • WASM build: cargo build --package trusted-server-adapter-fastly --release --target wasm32-wasip1
  • Manual testing via fastly compute serve
  • Other: cargo test-fastly; cargo clippy-fastly

Checklist

  • Changes follow CLAUDE.md conventions
  • No unwrap() in production code — use expect("should ...")
  • Uses tracing macros (not println!)
  • New code has tests
  • No secrets or credentials committed

HEAD Content-Length describes the corresponding GET representation, not
a body that will be buffered. Applying the buffered-response limit to
that metadata prevents valid S3 Image Optimizer preflights from
reaching their streamed GET request.

Resolves: #950
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Oversized S3 assets fail Image Optimizer HEAD preflight

2 participants