Question
I am trying to run Twiki on port 81 but port is removed from all the links. For example, I set the following:
$TWiki::cfg{DefaultUrlHost} = 'http://ww2.domain.com:81';
But the link to edit is:
http://ww2.domain.com/~twiki/bin/edit/TWiki/WebHome?t=1183051890
How do I get the port number in the links?
I think the problem might be occuring because I am behind a firewall. Apache is on port 80 and my router is redirecting from 81 to 80.
Thanks, Moses
Environment
--
TWikiGuest - 28 Jun 2007
Answer
If you answer a question - or someone answered one of your questions - please remember to edit the page and set the status to answered. The status selector is below the edit box.
This is a bit tricky. Not the non-standard port, this works quite fine, but the router/redirection part. TWiki sort of "knows" it is running on Port 80 from this environment, so it overrides your setting of
%$TWiki::cfg{DefaultUrlHost}.
So you need to cheat.
The URLs for the TWiki standard links are usually created by the TWiki templates. Unfortunately different versions of pattern skin are different in their organisation, and my installation here is a bit outdated, so this is just a guess from SVN....
Look for a file called
/templates/viewtopicactionbuttons.pattern.tmpl. The current version has lines like:
%TMPL:DEF{"edit_topic_link"}%<span class="patternButton"><a href='%SCRIPTURL{"edit"}%/%WEB%/%TOPIC%?t=%GMTIME{"$epoch"}%%TMPL:P{"url_param_editaction"}%' rel='nofollow' %MAKETEXT{"title='Edit this topic text' accesskey='e'>&Edit"}%</a></span>%TMPL:END%
In this and similar lines, replace
%SCRIPTURL{ by
%DEFAULTURLHOST%/%SCRIPTURLPATH{.
Additionally, you might want to change one line in
/templates/twiki.pattern.tmpl:
<base href="%SCRIPTURL{%SCRIPTNAME%}%/%WEB%/%TOPIC%"></base>
Here, too, replace
%SCRIPTURL{ by
%DEFAULTURLHOST%/%SCRIPTURLPATH{%.
To avoid problems with further updates of pattern skin, you might want to create an own skin
derived from pattern, or save the difference as a patch file... whatever seems easiest to do.
--
HaraldJoerg - 29 Jun 2007
That worked, thanks. I'm still having some problems that I think are probably related to the port. If I click on edit I get "The page cannot be displayed". The URL looks like this:
http://ww2.domain.com:81/~twiki/bin/edit/TWiki/WebHome?t=1183124012
Any idea what could be wrong?
Thanks,
Moses
--
TWikiGuest - 29 Jun 2007
The URL looks exactly like it should, according to the information you have provided so far. How do your
view URLs look like? What do you see in the access and error log files of Apache?
--
HaraldJoerg - 29 Jun 2007
Thanks for writing back! Here are the apache errors:
[Sun Jul 01 07:28:06 2007] [error] [client 209.6.216.235] Subroutine TWiki::Configure::Checker::tmpfile redefined at /usr/lib/perl5/5.8.6/Exporter.pm line 65., referer:
http://ww2.flamingvan.com:81/~twiki/
[Sun Jul 01 07:28:06 2007] [error] [client 209.6.216.235] at /usr/lib/perl5/5.8.6/i386-linux-thread-multi/POSIX.pm line 19, referer:
http://ww2.flamingvan.com:81/~twiki/
[Sun Jul 01 07:28:06 2007] [error] [client 209.6.216.235] Subroutine TWiki::Configure::Checker::tmpnam redefined at /usr/lib/perl5/5.8.6/Exporter.pm line 65., referer:
http://ww2.flamingvan.com:81/~twiki/
[Sun Jul 01 07:28:06 2007] [error] [client 209.6.216.235] at /usr/lib/perl5/5.8.6/i386-linux-thread-multi/POSIX.pm line 19, referer:
http://ww2.flamingvan.com:81/~twiki/
--
TWikiGuest - 01 Jul 2007
There is a
{RemovePortNumber} configure setting to remove/keep the port number.
--
PeterThoeny - 12 Aug 2007