We've got a bunch of legacy code that uses $ENV{SCRIPT_URI},
$ENV{SERVER_PORT}, $r->server->port and the like to generate external
redirects.
This has worked fine til now, but now we are moving to a system where
our external port != our internal port - the load balancer is going to
forward ports 80 and ports 443 to non-secure ports 8080 and 8443 (so
that we can run httpd as a non-root user.) Unfortunately, the code
mentioned above will then use the wrong (internal) ports in the
redirects. If I were using Apache reverse proxy, ProxyPassReverse
would take care of this, but I'm not.
The legacy code is scattered in many files and will be difficult to
change. Thus I'm wondering if there's an easy way to get %ENV and $r
to reflect the external ports, without going through and changing each
port-related $ENV and $r value by hand.
e.g. In the Apache code I see that the ENV vars are populated via
ap_get_server_port - is there a way for me to hook in early enough
that I can change this?
Thanks
Jon
- getting $r and env to reflect external ports Jonathan Swartz
-