Skip to content

fix(req): normalize forwarded protocol casing#7330

Open
lin-hongkuan wants to merge 1 commit into
expressjs:masterfrom
lin-hongkuan:codex/express-protocol-lowercase
Open

fix(req): normalize forwarded protocol casing#7330
lin-hongkuan wants to merge 1 commit into
expressjs:masterfrom
lin-hongkuan:codex/express-protocol-lowercase

Conversation

@lin-hongkuan

@lin-hongkuan lin-hongkuan commented Jun 24, 2026

Copy link
Copy Markdown

This normalizes trusted X-Forwarded-Proto values to lowercase before exposing req.protocol, so req.secure handles HTTPS the same as https.

The regression tests cover both req.protocol and req.secure with uppercase forwarded protocol input.

Validation:

  • npx mocha --require test/support/env --check-leaks test/req.protocol.js test/req.secure.js
  • npm run lint
  • git diff --check

AI-assisted: Codex helped prepare this focused change; I reviewed the diff and ran the validation above before submitting.

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.

1 participant