Feature Proposal: Sometimes its necessary to force the hostname set in {DefaultUrlHost}.
Motivation
I want to run Foswiki behind a reverse proxy, which translates from https to http. Because Foswiki is queried with http internally, it renders all urls with http (as in the query url) altough the {DefaultUrlHost} is set to https.
Browser <--https--> Reverse Proxy <--http--> Foswiki
The problem gets even worse if you want to keep track of the HTTP/HTTPS initial connection: e.g. all connections done with HTTP should stay HTTP, and all connections in HTTPS should stay in HTTPS. You then need to be able to discriminate on the port number.
Description and Documentation
Introduce a {ForceDefaultUrlHost} setting to force foswiki to use the given hostname instead of the calculated one from the query url. This can be acheived with a single line of code in Foswiki.pm.
Changing
if ( $url && $url =~ m{^([^:]*://[^/]*).*$} ) {
to
if ( $url && $url =~ m{^([^:]*://[^/]*).*$} && !$Foswiki::cfg{ForceDefaultUrlHost} ) {
around line 1371 in 1.0.5 would do the trick.
Impact
Implementation
--
Contributors: OliverKrueger - 21 Jul 2009
Discussion
don't forget a bunch of unit tests for this setting
See also
Tasks.Item1872
--
MarcSCHAEFER - 02 Aug 2009
--
SvenDowideit - 27 Jul 2009
I am a bit concerned that this proposal has not been reviewed much because we are in the middle of vacation time.
I will raise concern and remove it in a week or two. If noone raised additional concern, the proposal is accepted.
--
KennethLavrsen - 03 Aug 2009
This proposal solves my problem in Foswiki 1.0.5 (see
Tasks.Item1685). My tests with 1.0.6 were a "validation" disaster, I cannot say that this part works.
--
WolfgangRaus - 06 Aug 2009
It works with 1.0.6 also (bypassing the validation problems...). A good solution. Thanks!
--
WolfgangRaus - 07 Aug 2009
Ping
KennethLavrsen.
--
OliverKrueger - 30 Aug 2009
Concern removed. Accepted
--
KennethLavrsen - 05 Oct 2009
Oliver, this has been hanging around in TBD for nearly 3 years now; can we do something with it? If so, simply remove my concern.
--
CrawfordCurrie - 24 Feb 2012
I just implemented the above fix by hand. It is a must when using foswiki behind an ssl-terminating load-balancer (e.g. haproxy+stunnel). This is an easy no-brainer - hope it makes it into 1.2!
--
WryFi - 25 May 2012
It's been around for too long, and is accepted. I'll get it into 1.2. Opened
Item11900. Crawford, I removed your Concern.
--
GeorgeClark - 26 May 2012