tags 454347 +patch
thanks

On Wed, May 21, 2008 at 09:57:43PM +0200, Olivier Berger wrote:
> On Tue, Dec 04, 2007 at 11:06:02PM +0100, Olivier Berger wrote:
> > 
> > Whenever twiki was installed, the apache.conf file contains RewriteRules 
> > like :
> > 
> > RedirectMatch /twiki/?$ http://localhost/cgi-bin/twiki/view$1
> > RedirectMatch /twiki(/([A-Z].*)?)?$ http://localhost/cgi-bin/twiki/view$1
> > 
> > In the example above, the address for the host input in debconf question 
> > was localhost.
> > 
> > However, when reconfiguring, the new value input for that host won't be 
> > modified in apache.conf :(
> > 
> > I think the problem comes from the way the file is modified by the postinst 
> > script, which does this :
> > perl -pi~ -e '$U=q{'"$RET"'}; s{http://your.domain.com}{$U}g;' 
> > /etc/twiki/LocalSite.cfg
> > perl -pi~ -e '$U=q{'"$RET"'}; s{http://your.domain.com}{$U}g;' 
> > /etc/twiki/apache.conf
> > 
> > This takes for granted that the file initally contains stuff like :
> > RedirectMatch /twiki(/([A-Z].*)?)?$ 
> > http://your.domain.com/cgi-bin/twiki/view$1
> > 
> > The substitution regex should look for a RewriteRule and not only the URL 
> > base.
> > 
> 
> Maybe the directives may simply be written as :
> 
>  RedirectMatch /twiki/?$ /cgi-bin/twiki/view$1
>  RedirectMatch /twiki(/([A-Z].*)?)?$ /cgi-bin/twiki/view$1
> 
> As this seems to work (at least in apache 2.2), according to docs at : 
> http://httpd.apache.org/docs/2.2/mod/mod_alias.html#redirect :
> 
> "The new URL should be an absolute URL beginning with a scheme and hostname, 
> but a URL-path beginning with a slash may also be used, in which case the 
> scheme and hostname of the current server will be added."
> 
> Thus there would be no need to reconfigure that during postinst.
> 

In between, I think the accompanying patch should at least fix the most obvious 
regexp match in apache.conf.

Hope this helps.
diff -Naur twiki-4.1.2.orig/debian/postinst twiki-4.1.2/debian/postinst
--- twiki-4.1.2.orig/debian/postinst	2008-11-13 16:09:23.000000000 +0100
+++ twiki-4.1.2/debian/postinst	2008-11-13 16:11:28.000000000 +0100
@@ -59,7 +59,7 @@
 db_get twiki/defaultUrlHost
 # be more robust later:
 perl -pi~ -e '$U=q{'"$RET"'}; s{http://your.domain.com}{$U}g;' /etc/twiki/LocalSite.cfg
-perl -pi~ -e '$U=q{'"$RET"'}; s{http://your.domain.com}{$U}g;' /etc/twiki/apache.conf
+perl -pi~ -e '$U=q{'"$RET"'}; s{http://localhost}{$U}g;' /etc/twiki/apache.conf
 #remove the double //cgi-bin caused by putting a / at the end of the hostUrl
 perl -pi~ -e 's{/(/cgi-bin)}{$1}g;' /etc/twiki/apache.conf
 #perl -pi~ -e '$U=q{'"$RET"'}; s{^(Redirect\s+/twiki/index.html\s+).*(cgi-bin/twiki/view\n)$}{$1$U$2};' /etc/twiki/apache.conf

Reply via email to