Symfony port redirection behind reverse proxy
In addition to @Gor I think you should also configure your proxy to add X-Forwarded headers. In Nginx something like
location / { proxy_pass http://myurl:8443; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header X-Forwarded-Port $server_port; }
Open the following file:
web/app.php
Right after this line:
$request = Request::createFromGlobals();
Insert this block:
// tell Symfony about your reverse proxyRequest::setTrustedProxies( // the IP address (or range) of your proxy ['192.0.0.1', '10.0.0.0/8'], // trust *all* "X-Forwarded-*" headers Request::HEADER_X_FORWARDED_ALL // or, if your proxy instead uses the "Forwarded" header // Request::HEADER_FORWARDED // or, if you're using AWS ELB // Request::HEADER_X_FORWARDED_AWS_ELB);
See:
"How to Configure Symfony to Work behind a Load Balancer or a Reverse Proxy"http://symfony.com/doc/3.4/deployment/proxies.html