Tags:
create new tag
, view all tags

Question

In the TWikiAccessControl document under the 'Controlling access to Attachments' section it discusses how to have documents published under the /pub directory be processed by the bin/viewfile script. Does anyone have this working? I've been reading the apache rewrite documentation but can't seem to get the rewrite rule to work correctly so I thought I'd see if others had it working at all.

Environment

TWiki version: TWikiRelease04x00x02
TWiki plugins: DefaultPlugin, EmptyPlugin, InterwikiPlugin
Server OS: Debian GNU/Linux (stable)
Web server: Apache
Perl version: 5.8
Client OS: Ubuntu (dapper)
Web Browser: firefox
Categories: Permissions, Security, Documentation

-- RobLeach - 12 Jun 2006

Answer

ALERT! If you answer a question - or have a question you asked answered by someone - please remember to edit the page and set the status to answered. The status is in a drop-down list below the edit box.

I did some experiments with it.

One thing I found out.

Rewrite rules written at a global level in httpd.conf or in a file included from httpd.conf are not valid inside a virtual host.

To make it work I had to include a twiki.conf file that contains the twiki config including the rewrite rules from within the virtual host section.

Example in httpd.conf

<VirtualHost *:80>
    ServerName www.mydomain.com
    Include /var/www/twiki.conf
</VirtualHost>

And the twiki.conf is then not included inside the global part of httpd.conf

In the twiki.conf you can then put the rewrite rules.

I did not finish testing this to the end but the syntax is something like

RewriteEngine on
RewriteRule ^/twiki/pub/TWiki/(.*)$  /twiki/pub/TWiki/$1 [L,PT]
RewriteRule ^/twiki/pub/(.*\.gif)$  /twiki/pub/$1 [L,PT]
RewriteRule ^/twiki/pub/([^\/]+)/([^\/]+)/([^\/]+)$  /twiki/bin/viewfile/$1/$2?filename=$3 [L,PT]

viewfile is very slow compared to the direct access to pub so you do not want all the css files, javascript files, graphics files etc to be loaded with viewfile. Only the real attachments in your own Webs. Otherwise TWiki will becomes very slow.

-- KennethLavrsen - 24 Jun 2006

 
Topic revision: r3 - 2006-06-25 - SteffenPoulsen
 
Twitter Delicious Facebook Digg Google Bookmarks E-mail LinkedIn Reddit StumbleUpon    
  • Download TWiki
TWiki logo Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2012 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.