Skip to content

[Bug] Cannot set trustProxy with fastify-cli #873

@shanliuling

Description

@shanliuling

Prerequisites

  • I have written a descriptive issue title
  • I have searched existing issues to ensure the bug has not already been reported

Fastify version

4.12.0

Node.js version

18.12.1

Operating system

macOS

Description

I cannot set trustProxy to true when starting my fastify server with fastify-cli.

Steps to Reproduce

  1. Use config.js:
    \\javascript
    module.exports = {
    trustProxy: true,
    port: 3300
    }
    \
    then run: \ astify start -l warn --config config.js dist/App.js\

  2. Use .env file:
    \TRUST_PROXY=true\ or \TRUST_PROXY=1\

  3. Pass env variable:
    \TRUST_PROXY=true fastify start -l warn dist/App.js\

None of them are setting trustProxy to true. The only way it works is by creating the server manually with trustProxy: true in code.

Expected Behavior

I expected at least one of them to work, the env file or config.js

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions