Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot set trustProxy with fastify-cli #619

Open
2 tasks done
alexandrucancescu opened this issue Apr 27, 2023 · 3 comments
Open
2 tasks done

Cannot set trustProxy with fastify-cli #619

alexandrucancescu opened this issue Apr 27, 2023 · 3 comments
Labels
bug Confirmed bug

Comments

@alexandrucancescu
Copy link

alexandrucancescu commented Apr 27, 2023

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

Plugin version

No response

Node.js version

18.12.1

Operating system

macOS

Operating system version (i.e. 20.04, 11.3, 10)

13.1

Description

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

Steps to Reproduce

1. Use config.js

module.exports = {
    trustProxy: true,
    port: 3300
}

then run it with:

fastify start -l warn --config config.js dist/App.js

2. .env file

TRUST_PROXY=TRUE
TRUST_PROXY=true

and also

TRUST_PROXY=1

3. Pass env variable

TRUST_PROXY=true fastify start -l warn dist/App.js

And all other variations ( TRUE, 1, true )

None of them are setting trustProxy to true, I tested it. The only way it works is by creating the server manually:

const app = Fastify({
	trustProxy: true,
	logger: {
		level: "info"
	}
});

Expected Behavior

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

@mcollina
Copy link
Member

mcollina commented May 3, 2023

Thanks for reporting! Would you like to send a Pull Request to address this issue? Remember to add unit tests.

@mcollina mcollina added the bug Confirmed bug label May 3, 2023
@yazaldefilimone
Copy link
Contributor

Let me try it

@yazaldefilimone
Copy link
Contributor

hei @alexandrucancescu I resolve that in #654

@Eomm Eomm linked a pull request Aug 13, 2023 that will close this issue
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Confirmed bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants