Skip to content

Route requests carrying DNT and GPC headers - #47

Merged
mandatoryprogrammer merged 3 commits into
mandatoryprogrammer:mainfrom
m4dni5:pr-dnt
Oct 5, 2026
Merged

mandatoryprogrammer merged 3 commits into
mandatoryprogrammer:mainfrom
m4dni5:pr-dnt

Conversation

@m4dni5

@m4dni5 m4dni5 commented Sep 9, 2026 •

Copy link
Copy Markdown
Contributor

Requests carrying DNT or Sec-GPC can fail with HTTP 500 before reaching Chrome because the router treats these browser-controlled privacy headers as author-supplied CORS headers. This affects navigation, ordinary form submissions, and page resources.

Ignore both header names, case-insensitively, only for routing classification. Keep them separate from ALWAYS_CLEAN_HEADERS so the fix does not introduce an outgoing privacy-header stripping policy. Application headers, methods, and content types still undergo the existing checks. Chrome continues to control its own outgoing privacy signals; this does not promise to forward the caller's DNT/GPC preference to the destination.

This also corrects the original description: DNT is not sent by every Firefox request, and Chrome can send DNT when its setting is enabled. Firefox removed the DNT setting in version 135 and supports GPC instead. Fresh local Firefox 140.14.0 ESR profiles confirmed no DNT by default and Sec-GPC: 1 when GPC was enabled.

Validation used existing container images with Chrome 142.0.7444.175 and current main plus this patch. Forty local HTTP requests through the host proxy port exercised before/after navigation, form, resource, fetch, mixed-case names, DNT: 0, combined headers, header-only requests, JSON bodies, and controls for unrelated headers/content types. Successful responses had exact body bytes and correct lengths; form and JSON payloads reached the origin intact. Two cases enabled Chrome's own DNT setting and confirmed it still sent DNT: 1, even with inbound DNT: 0. Fresh profiles, certificates, containers, and the test network were isolated and cleaned up. No local dependency installs, image pulls, or committed test suite were added.

Implementation details and manual verification are recorded in _readme/internal-notes.md.

Firefox sends DNT: 1 on every request. DNT is not in
ALWAYS_CLEAN_HEADERS, so any request carrying it fails the
CORS-simple classification in is_simple_cors_request, matches no
routing rule, and returns a 500 to the client. Every Firefox page
navigation through the proxy hits this.

Real Chrome does not send DNT, so stripping it also matches the
stealth intent of the clean-headers list.
@m4dni5
m4dni5 marked this pull request as ready for review September 9, 2026 23:40
@mandatoryprogrammer mandatoryprogrammer changed the title Strip DNT header so Firefox navigations route correctly Route requests carrying DNT and GPC headers Oct 5, 2026
@mandatoryprogrammer

Copy link
Copy Markdown
Owner

Easy enough, also added another potential header that might cause problems in Firefox. In a future edit I think this might make sense to pull out into a configurable env var...

@mandatoryprogrammer
mandatoryprogrammer merged commit eb1e8aa into mandatoryprogrammer:main Oct 5, 2026
2 checks passed
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.

2 participants