Question
I have developed a TWiki Environment on my laptop and am now
trying to get it installed for the whole company. TWiki is
installed on lek.gnat.com but the only access to this
TWiki web is
https://www.gnat.com/twiki/
.
The only pages which are visible are those that are explicitly
addressed such as
https://www.gnat.com/twiki/bin/view/Main/ActWebHome
or
https://www.gnat.com/twiki/vin/view/Main/ActUsers
When we try to reference any of the links in the page, say clicking
on
WesEmbry in the
ActUsers page, we get a reference to
http://foo.gnat.com/twiki/bin/view/Main/WesEmbry
which of course
gives a forbidden page error.
This is certainly because the CGI PATH_INFO is being set to
http://foo.gnat.com/twiki/bin
testenv is showing this and the "Test this now" link for PATH_INFO
is of course failing.
The environment variables show that
HTTP_HOST is foo.gnat.com
HTTP_X_FORWARDED_HOST is www.gnat.com
REMOTE_HOST is plym.gnat.com
REMOTE_PORT is 41398
SERVER_NAME is foo.gnat.com
SERVER_PORT is 80
What should I set to get a relative path for links to the TWiki webs?
- TWiki version:01 Feb 03
- Perl version: 5.6.0
- Web server & version:Apache 1.3.27
- Server OS:Linux 2.4.18
- Web browser & version: Mozilla 1.2.1
- Client OS: Linux 2.4.20
--
WesEmbry - 09 Jul 2003
Answer
While waiting to answer for real experts, what is value of
$defaultUrlHost variable in your
lib/TWiki.cfg file? Is it foo.gnat.com of www.gnat.com?
--
PeterMasiar - 10 Jul 2003
Answer
$defaultUrlHost is currently set to foo.gnat.com so that it is the same as $HTTP_HOST.
I did set it to www.gnat.com but this did not change the behavior and testenv complained
about it.
--
WesEmbry - 10 Jul 2003
TWiki picks the http protocol and host from the cgi environment. This is because in some installations TWiki is accessed as http and https for the same installation. The
$defaultUrlHost variable is only used in case TWiki is accessed by a shell script (e.g. a cron job).
Your environment is kind of unusual. The problem seems to be
HTTP_HOST = foo.gnat.com. Check your Apache configuration if you can set that to
www.gnat.com.
As a workaround you could force TWiki to use
$defaultUrlHost in all cases. Do that in
TWiki.pm, sub
initialize, by adding the red line:
# initialize $urlHost and $scriptUrlPath
if( ( $theUrl ) && ( $theUrl =~ /^([^\:]*\:\/\/[^\/]*)(.*)\/.*$/ ) && ( $2 ) ) {
if( $doGetScriptUrlFromCgi ) {
$scriptUrlPath = $2;
}
$urlHost = $1;
if( $doRemovePortNumber ) {
$urlHost =~ s/\:[0-9]+$//;
}
$urlHost = $defaultUrlHost;
} else {
$urlHost = $defaultUrlHost;
}
FYI, TWiki uses absolute URLs to avoid some issues with certain environments.
--
PeterThoeny - 21 Jul 2003