fix(server): preserve asset content types when compression is accepted - #10948
fix(server): preserve asset content types when compression is accepted#10948Gigioxx wants to merge 1 commit into
Conversation
ApprovabilityVerdict: Approved at Macroscope's review found this PR approvable — This is a narrow server bug fix that prevents broken compression from stripping asset MIME types and preserves existing security headers. Its only runtime tradeoff is disabling transformation/compression for asset responses, with targeted HTTP regression coverage and no broader API, schema, or infrastructure impact. You can add or adjust custom eligibility rules. Learn more. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (2)
Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review. 📝 WalkthroughWalkthroughAsset responses now include ChangesAsset response handling
Priority: ⬆️ High Estimated code review effort: 3 (Moderate) | ~20 minutes Severity of issue fixed: High Merge Risk: ⚪ Minimal · up to Asset responses now avoid transformation when compression is accepted, preserving content types and security headers for browser-rendered files. The updated behavior is covered for common asset types and is ready to merge. Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
Browser compression strips Content-Type from file assets in Effect rc.112, so HTML previews show source and sibling stylesheets fail to load.
Add
no-transformto asset Cache-Control headers, including the guarded-video override, as recommended in the issue triage. This bypasses the broken compression path while preserving caching and sandbox headers. The upstream fix is tracked in Effect-TS/effect#8146.Reproduced on a real Node HTTP test server: an HTML response keeps its type with identity encoding and loses it when browser compression is accepted. Four regression cases now verify HTML, CSS, JavaScript, and SVG response types, bodies, and security headers with both encodings. All 25 HTTP tests, server typecheck, and targeted lint pass.
Fixes #10935.
Implemented with GPT-6 in Codex.
Summary by CodeRabbit