analysis
[ikiwiki.git] / doc / bugs / Running_on_an_alternative_port_fails.mdwn
index ca835cb594d5fc75f4c79c81634706233b027104..b97f64383f000c0a3e19af07b76930334efe0396 100644 (file)
@@ -24,6 +24,22 @@ right.
 
 >>>     SERVER_PORT=8181  
 >>>     HTTP_HOST=zippy0.ie0.cobbled.net  
+
+>>>> In apache, `HTTP_HOST` includes the port. This is not part of the CGI
+>>>> spec it seems, but perl's `CGI` module seems to rely on it,
+>>>> in `virtual_port`:
+
+<pre>
+    my $vh = $self->http('x_forwarded_host') || $self->http('host');
+    my $protocol = $self->protocol;
+    if ($vh) {
+        return ($vh =~ /:(\d+)$/)[0] || ($protocol eq 'https' ? 443 : 80);
+</pre>
+
+>>>> The `CGI` module only looks at `SERVER_PORT` when there's no
+>>>> `HTTP_HOST`. So this is either a bug in perl's CGI or thttpd.
+>>>> --[[Joey]]
+
 >>>     HTTP_ACCEPT_LANGUAGE=en-ie, en  
 >>>     PATH=/usr/local/bin:/usr/ucb:/bin:/usr/bin  
 >>>     SCRIPT_NAME=/cgi-bin/printenv.sh  
@@ -46,5 +62,10 @@ right.
 
 >> which I'd guess is from Apr last  year.  Will look for updates and post back if still
 wrong.
+
 >> Cheers
+
 >> -- fergus
+
+>> PS: all the links generated by CGI pages omit the port; this works if i login first and then
+reset the server on the 'odd' port -- hovering over the links absolute links with the port missing.