-
-
Notifications
You must be signed in to change notification settings - Fork 48
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
Feat: support for RR in Docker behind proxy in another Docker #131
base: 3.x
Are you sure you want to change the base?
Conversation
Did you tried the If the proxy is local, you should add 127.0.0.1. I did it locally and it seems to work as expected: $ curl http://localhost:8080/test -H 'x-forwarded-proto: https'
{"url":"https:\/\/localhost:8080\/home"}
$ curl http://localhost:8080/test
{"url":"http:\/\/localhost:8080\/home"} |
I did try, my framework:
trusted_proxies: '127.0.0.1/8,REMOTE_ADDR,SERVER_NAME'
trusted_headers: [ 'x-forwarded-for', 'x-forwarded-host', 'x-forwarded-proto', 'x-forwarded-port', 'x-forwarded-prefix' ] That did not work, until I added changes in this PR. Basically, my setup is like this: HTTPS Web > Nginx in Docker > HTTP to RR & Symfony in another Docker |
By chance, would you be able to provide a reproducer repo? |
Not sure if entirely possible. I bumped into that issue after deploying to production - on real domain. The docker nginx proxy cannot generate/use self signed certificates to simulate it locally. You need to have live domain. If thats okay, I can probably create reproducer with docker-compose, tho you will need to deploy it somewhere yourself. |
Yeah I have domains to test it :) |
@FluffyDiscord I had the similar problem and the problem was in "trusted_proxies" param
For example, on local env I am using "nginx-proxy" docker image and it pass the ip 192.168.0.0/16 Also, we are mapping the x-forwarded-* in nginx config for prod |
If RR is running inside Docker and we simply pass
https
requests from proxy (basicaly proxy manages certificates) to the RR instance ashttp
, the parseduri
scheme in this bundle will always be in this casehttp
and Symfony will now use invalid schema or add 443 port when generating URLs.Checking if
X-Forwarded-Proto
is trusted header and making it priority inHttpFoundationWoker->configureServer()
fixes this issue. To make the rest of Symfony proxy features work we also need to setREMOTE_ADDR
to theX-Forwarded-For
header, also only if its trusted.This should be a non breaking change for everyone.