Se si fanno redirezioni, il valore di SERVER_PORT viene resettato a 80 anche se il web server è configuarato per girare su porta diversa!

https://issues.apache.org/bugzilla/show_bug.cgi?id=35999

http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/http/http_request.c?view=log&pathrev=807015

reserve port over internal redirection
PR#35999
A four-year-old buglet!

Patch:

diff -urp httpd-2.0.54.orig/modules/http/http_request.c httpd-2.0.54/modules/http/http_request.c
--- httpd-2.0.54.orig/modules/http/http_request.c    2005-04-09 00:10:13.000000000 +0200
+++ httpd-2.0.54/modules/http/http_request.c    2005-07-13 19:48:26.866158667 +0200
@@ -319,6 +319,8 @@ static request_rec *internal_internal_re
 new->method_number   = r->method_number;
 new->allowed_methods = ap_make_method_list(new->pool, 2);
 ap_parse_uri(new, new_uri);
+    new->parsed_uri.port_str = r->parsed_uri.port_str;
+    new->parsed_uri.port = r->parsed_uri.port;

 new->request_config = ap_create_request_config(r->pool);

Workaround nella configurazione:

http://httpd.apache.org/docs/2.2/mod/core.html#usecanonicalphysicalport

UseCanonicalName off
UseCanonicalPhysicalPort On