On Mon, Aug 23, 2010 at 3:51 PM, Freek Dijkstra <pub...@macfreek.nl> wrote:
> [My apologies for the many posts; I just notices that my mailer removed > the <tags> thinking it was HTML] > > Freek Dijkstra wrote: > > > Curious, > > <Directory ~ "^/var/www/projects/.*$"> is never matched > > <Directory ~ "^/var/www/projects/.*"> is matched. > > Logically, I would have expected both regexps to yield the same result. > > I did some more testing, and it just seems that the the end of line > anchor is just never matched. I can easily reproduce it with only a few > configuration lines (see below). > > Is this a (known) bug or is there another explanation why I'm seeing > this behaviour? If this is intended behaviour, what configuration is > required to get the intended behaviour? > > > Steps to reproduce > 1. Add the following configuration to httpd.conf: > > Alias /test/ /var/www/test/ > > <Directory "/var/www/test/projects"> > Options Indexes > Order deny,allow > Deny from all > </Directory> > > <Directory ~ "/var/www/test/projects/$"> > Allow from all > </Directory> > > > Expected results: > - requesting http://localhost/test/projects would give an autoindex > - requesting http://localhost/test/projects/subdir would give a 403 > Forbidden > > Actual results: > - requesting http://localhost/test/projects gives a 403 Forbidden > - requesting http://localhost/test/projects/subdir gives a 403 Forbidden > > Regression: > 1. > The following DirectoryMatch (without trailing /) gives the same result: > <Directory ~ "/var/www/test/projects$"> > Allow from all > </Directory> > > 2. > Adding an Allow from all for a specific subdirectory works as expected > (requesting the directory shows an autoindex): > <Directory "/var/www/test/projects/subdir1"> > Allow from all > </Directory> > > 3. > <Directory ~ "^/var/www/test/projects/.*$"> > Allow from all > </Directory> > results in 403 Forbidden for all requests. The DirectoryMatch is never > matched. > > 4. > <Directory ~ "^/var/www/test/projects/.*"> > Allow from all > </Directory> > results in autoindexes for all requests. The DirectoryMatch is always > matched, as expected. > > 5. > The regular expressions > "^/var/www/test/projects/.*$" > "^/var/www/test/projects/.*" > are logically the same. However Apache clearly treats them differently > (see 3 and 4 above). This seems like a bug to me. > > 6. Replacing the Directory directives with corresponding Location > directives gives the same result. > > > Notes: > 1. Tested with Apache 2.2.9 on Linux, Apache 2.2.14 on Mac OS X and > Apache 2.2.15 on Mac OS X. > 2. The note at > > http://stackoverflow.com/questions/1665210/apache-config-exclude-subdirectories > indicates other people encounter this problem too. ("For some reason my > apache on Fedora 8 seems to be ignoring the end of line anchor in the > regular expression"). > > --------------------------------------------------------------------- > The official User-To-User support forum of the Apache HTTP Server Project. > See <URL:http://httpd.apache.org/userslist.html> for more info. > To unsubscribe, e-mail: users-unsubscr...@httpd.apache.org > " from the digest: users-digest-unsubscr...@httpd.apache.org > For additional commands, e-mail: users-h...@httpd.apache.org > >