Skip to content

fix: restore trustProxy function for number and string types, add null check for socketAddr#6613

Merged
mcollina merged 1 commit into
fastify:mainfrom
mcollina:fix/issue-6606
Mar 28, 2026
Merged

fix: restore trustProxy function for number and string types, add null check for socketAddr#6613
mcollina merged 1 commit into
fastify:mainfrom
mcollina:fix/issue-6606

Conversation

@mcollina

Copy link
Copy Markdown
Member

Fixes #6606

Description

The regression was introduced when the proxy trust function was changed to check for null addresses. This caused issues with IISNode on Windows where may be undefined/null with .

Changes

  • Removed the a != null check from number and string trust proxy functions
  • Added explicit null checks in host and protocol getters
  • Added tests for trustProxy: 1 with undefined and null socket remoteAddress

Testing

All existing tests pass, plus new tests for the IISNode scenario.

…l check for socketAddr

Fixes: fastify#6606

The regression was introduced when the proxy trust function was changed
to check for null addresses. This caused issues with IISNode on Windows
where socket.remoteAddress may be undefined/null with enableXFF='true'.

The fix removes the 'a != null' check from number and string trust
functions, and adds explicit null checks in host and protocol getters.

@gurgunday gurgunday left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@mcollina mcollina merged commit 8dee9be into fastify:main Mar 28, 2026
32 checks passed
@Eomm Eomm added the bugfix Issue or PR that should land as semver patch label Mar 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bugfix Issue or PR that should land as semver patch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Regression on Fastify V5.8.3 with trustProxy: 1 for Windows IISNODE servers

4 participants