Skip to content

Enable trusted proxies in Symfony >= 3.3 #114

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

Merged
merged 1 commit into from
Jun 25, 2018
Merged

Conversation

mathieudz
Copy link
Contributor

Fixes php-pm issue #257 & requires Symfony 3.3.
In my case, this is needed to detect whether HTTPS is used or not. Using nginx as reverse proxy.
The code is directly copy pasted from Symfony 4.x index.php.

@andig
Copy link
Contributor

andig commented Jun 22, 2018 via email

@mathieudz
Copy link
Contributor Author

mathieudz commented Jun 22, 2018

It should be read from the .env file. Maybe there are other ways, but I suppose that a client cannot set $_SERVER?
If you mean that a client could set the X-Forwarded headers: the app should only be accessible through the RP.

@mathieudz mathieudz changed the title Enable trusted proxies in Symfony. Enable trusted proxies in Symfony >= 3.3 Jun 23, 2018
@andig
Copy link
Contributor

andig commented Jun 25, 2018

If you mean that a client could set the X-Forwarded headers: the app should only be accessible through the RP.

Thats what I'm concerned about. I find it kind of dangerous to trust the X_ headers?

@mathieudz
Copy link
Contributor Author

mathieudz commented Jun 25, 2018

That's why you specify with Request::setTrustedProxies() which hosts are allowed to send these headers. By default none are trusted.
For Symfony < 3.3 it was already possible with php-pm: see bottom of the php-pm's README.

@andig andig merged commit 305b9ab into php-pm:master Jun 25, 2018
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.

2 participants