fastify / fastify/help

Most secure trustProxy value for a local reverse proxy?

Open
#1,093 0 comments 0 reactions 0 assignees View on GitHub
help wanted
Dominant language
No language data
Stars
68
Forks
8
Avg merge
11h 2m
Merged PRs (30d)
2

Description

## 💬 Question here

The fastify service is listening on localhost and on the same server the reverse proxy listens externally on ports 80/443.

Since the fastify service isn't listening to external requests I think setting `trustProxy` to `true` *should* be safe. But I prefer using the strictest settings possible, better to do so and never need it than to not do so and regret it after it's too late.

What would that strictest setting be? To me it looks like it would be `"localhost"` based on the docs but will that cause any issues? Is it actually the strictest value that will work?

## Your Environment

- *node version*: 22
- *fastify version*: >=5.0.0
- *os*: Linux

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.