Skip to content

refactor(server): simplify error page by removing headers handling#6413

Merged
chenjiahan merged 1 commit intomainfrom
error_page_headers_1023
Oct 23, 2025
Merged

refactor(server): simplify error page by removing headers handling#6413
chenjiahan merged 1 commit intomainfrom
error_page_headers_1023

Conversation

@chenjiahan
Copy link
Member

Summary

This PR removes the logic that clears all existing response headers before sending an error page. The previous implementation provided no real security benefit, since clients that can access the error page can also access normal dev server responses and view the same headers.

Checklist

  • Tests updated (or not required).
  • Documentation updated (or not required).

Copilot AI review requested due to automatic review settings October 23, 2025 05:28
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 simplifies error handling in the assets middleware by removing unnecessary header manipulation logic. The change eliminates the ability to clear existing response headers and set custom headers when sending error pages, as this provided no security benefit since clients accessing error pages can also view normal dev server responses.

Key changes:

  • Removed SendErrorOptions type and optional headers parameter from sendError function
  • Eliminated logic that cleared all existing response headers before sending error pages
  • Simplified the call to sendError for range-not-satisfiable errors

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@netlify
Copy link

netlify bot commented Oct 23, 2025

Deploy Preview for rsbuild ready!

Name Link
🔨 Latest commit 3a338db
🔍 Latest deploy log https://app.netlify.com/projects/rsbuild/deploys/68f9bd14f916c10008c248e9
😎 Deploy Preview https://deploy-preview-6413--rsbuild.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
1 paths audited
Performance: 61 (🔴 down 7 from production)
Accessibility: 97 (no change from production)
Best Practices: 100 (no change from production)
SEO: 100 (no change from production)
PWA: 60 (no change from production)
View the detailed breakdown and full score reports

To edit notification comments on pull requests, go to your Netlify project configuration.

@chenjiahan chenjiahan merged commit 5ebfd1d into main Oct 23, 2025
12 checks passed
@chenjiahan chenjiahan deleted the error_page_headers_1023 branch October 23, 2025 05:41
@chenjiahan chenjiahan mentioned this pull request Oct 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant