Hi, 

This is something that has changed in 2.4 compared to 2.2.

When I follow the simple scenario (attached file) in a fresh 
install of apache, mod_dir is affecting the first value of 
DirectoryIndex to my request before it is being proxied. 

In 2.2, I was used to browse "https:/example,com/foo/" and have 
this being proxied to a backend as "https://example2.com/bar/";. 
But now in 2.4.7, mod_dir is first converting "/foo/" to
"/foo/index.html" and then sending the proxy request as
"/bar/index.html".

Do you know if this is an intended feature or a bug? I would
expect the backend, and not the frontend, to decide what
it wants to add to a url ending by "/".

The code in mod_dir has changed and there's a section with a comment
saying that it steps aside when it detects it is inside a mod_rewrite
fixup. It seems to be missing a provision for proxy requests.

rbowen helped me test this against 2.4.17/fedora. I tested it against
2.4.10/debian jessie with the same result.

Thanks! Cheers.

-jose
Scenario for mod_dir and mod_rewrite bug

Tested against 2.4.17 in a fresh fedora install (Thanks rbowen!)

I have this setup

   /foo/.htaccess
   /bar/echo.php

Server runs in localhost.

1. In your apache config, make sure you have the DirectoryIndex directive
   e.g. 
        DirectoryIndex index.html

2. Put the following php script under /bar/echo.php Its goal is to echo 
the request URI. You can do it with another script if you want:

[[
$ cat echo.php
<?php
echo "\nRequested: " .  $_SERVER['REQUEST_URI'] . "\n";
?>
]]

3. Put this .htaccess under /foo/.htaccess 
[[
$ cat .htaccess
RewriteEngine on
RewriteBase /foo
RewriteRule ^(.*)$ http://localhost/bar/echo.php/$1 [P,L]
]]

4. Try the test

   GET -Se http://localhost/foo/

If you get back: 

   Requested: ...echo.php/index.html
   # index.html is the first value of my DirectoryIndex directive

You see the bug, mod_dir added the first value of DirectoryIndex 
before doing the proxy request.

Reply via email to