Tags:
create new tag
view all tags

Question

hi,

just installed 4.0.4-2 and is trying to get twiki to authenticate my /twiki/pub/ directory this works fine for non-hierical webbs but for hierical webbs I have problems (followed TWikiAccessControl -> Controlling access to Attachments).

Here are some some snippets from the rewrite.log (running apache 1.3).

  • Using non-hierical webbs (OK):
I try to get "/twiki/pub/One/WebHome/data.zip" this gets rewritten by apache to "/twiki/bin/viewfile/One/WebHome?filename=data.zip"

Download is successful.

  • Using hierical webbs (problem):
I try to get "/twiki/pub/One/Two/WebHome/data.zip" this gets rewritten by apache to "/twiki/bin/viewfile/One/WebHome?filename=data.zip" for some reason the "Two"-webb is lost when sent to viewfile thus viewfile cant find file.

Is it my apache or is it the regexp that causes the problems?


Summary

Regexp (from doc mentioned above):

RewriteRule ^/+twiki/+pub/+([^/]+)/+((([^/]+)/+)+)(.+) /twiki/bin/viewfile/$1/$4?filename=$5 [L,PT]

To be rewritten: /twiki/pub/One/Two/WebHome/data.zip

Received: /twiki/bin/viewfile/One/WebHome?filename=data.zip

Expected: /twiki/bin/viewfile/One/Two/WebHome?filename=data.zip


Environment

TWiki version: TWikiRelease04x00x04
TWiki plugins: DefaultPlugin, EmptyPlugin, InterwikiPlugin
Server OS: linux mandrake
Web server: Apache-AdvancedExtranetServer/1.3.33 (Mandrakelinux/6.1.102mdk)
Perl version: 5.8.6
Client OS: win2000
Web Browser: firefox / ie
Categories: Authentication

-- TWikiGuest - 07 Aug 2006

Answer

ALERT! 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.

fyi I got it working when I changed to:

RewriteRule ^/+twiki/+pub/+(.+)/*/(.+) /twiki/bin/viewfile/$1?filename=$2 [L,PT]
In apache config, but I'd really would like to know if this is a problem in my installation, twiki or apache.

-- TWikiGuest - 07 Aug 2006

It's just a problem to determine, which part of the uri is the web, which one the topic and which one the filename.

I would use something like this:

RewriteRule ^/+twiki/+pub/+([^/]+(/+[^/]+)*)/+([^/]+)/+(.+) /twiki/bin/viewfile/$1/$3?filename=$4 [L,PT]

-- HolgerJust - 01 Oct 2006

Holger, this assumes a flat web structure. The regex needs to be changed if you have sub webs.

-- PeterThoeny - 01 Oct 2006

Hi,

Have a look at SecuringAttachments , The approach is different from mod_rewrite stuff- Look at my comments at the end of the topic. I have also attached perl module which helps to check the ACL of topic(hence attachments).

-- SopanShewale - 04 Oct 2006

See also ViewFileNotWorkingWithNestedWebs. The new regex I came up with is:

RewriteRule ^/+twiki/+pub((/+[^/]+)+)/+(.+) /twiki/bin/viewfile$1?filename=$3 [L,PT]

-- BenWheeler - 25 Sep 2007

Edit | Attach | Watch | Print version | History: r8 < r7 < r6 < r5 < r4 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r8 - 2007-09-25 - PeterThoeny
 
  • Learn about TWiki  
  • Download TWiki
This site is powered by the TWiki collaboration platform Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2026 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.