The goal is to get PHP aware of the correct web-facing server_port.
The setup is:
nginx on port 443 reverse proxying to varnish on port 80 reverse proxying to nginx on port 8008 and running php-fpm as a fastcgi.
hitting 80 or 443 both work fine except that $_SERVER['SERVER_PORT'] in php is always showing 8008 by default. I can hard code a fastcgi_param server_port but then it will only be correct for 80 or 443 but not both.
# default
fastcgi_param SERVER_PORT $server_port;
# harcode to 80
fastcgi_param SERVER_PORT 80;
How can I get the proper external-facing server port available to php?