[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#272799: It's a Buggy Feature : \



Thank you very much for your help! Using Directory directives has elicited some different behavior, but unfortunately, it still doesn't work. It doesn't behave the way you'd expect; I can't make rhyme nor reason of it.

I purged & reinstalled apache2-common, so my configuration is stock. I also created an experimental public_html directory, containing only ~user/public_html/cgi-bin/foo.cgi, where foo.cgi is a simple hello world. I tried the following directives in /etc/apache2/apache2.conf & restarted Apache after every change.

<Directory />
        RewriteEngine on

# Uncomment if you don't want a particular user's cgi-bin to use cgiwrap
        # You'll need to handle this yourself though!
        # RewriteCond  %{REQUEST_URI} !^/~username/cgi-bin/(.*)

        # Rewrite requests for user's cgi-bin to cgiwrap.
RewriteRule ^/([^/]+)/cgi-bin/(.*) /cgi-bin/cgiwrap/$1/$2 [PT] RewriteRule ^/([^/]+)/cgi-bin-d/(.*) /cgi-bin/cgiwrapd/$1/$2 [PT] RewriteRule ^/([^/]+)/nph-bin-d/(.*) /cgi-bin/nph-cgiwrapd/$1/$2 [PT] RewriteRule ^/([^/]+)/nph-bin/(.*) /cgi-bin/nph-cgiwrap/$1/$2 [PT]

</Directory>

This has no effect at all. I checked http://server/~user/cgi-bin/foo.cgi, http://server/~user/cgi-bin/foo, & http://server/~user/cgi-bin/; instead of being redirected to cgiwrap, I got foo.cgi's source, Apache error: 404 Not Found, & ~user/public_html/cgi-bin's listing, just the same as without RewriteRules.

<Directory />
        RewriteEngine on
        RewriteRule foo /cgi-bin/cgiwrap
</Directory>

This, by contrast, has an effect; yet still, not entirely as expected. http://server/~user/cgi-bin/foo.cgi & every other URL I checked containing foo are redirected to cgiwrap, except http://server/~user/cgi-bin/foo & other URLs directory/foo, where directory contains foo.cgi; these produce Apache error: 404 Not Found, & log this error:

==> error.log <==
[Wed Sep 22 21:35:39 2004] [error] [client 192.168.179.43] Negotiation: discovered file(s) matching request: /home/user/public_html/cgi-bin/foo (None could be negotiated).

<Directory />
        RewriteEngine on
        RewriteRule /[^/]+/cgi-bin/ /cgi-bin/cgiwrap
</Directory>

This also has an effect; also, not as you'd expect. http://server/~user/cgi-bin/foo.cgi, http://server/~user/cgi-bin/bar, http://server/~user/cgi-bin/, http://server/cgi-bin/cgiwrap, & http://server/cgi-bin/ all produce Apache error: 500 Internal Server Error, & log this error:

==> error.log <==
[Wed Sep 22 21:45:01 2004] [error] [client 192.168.179.43] mod_rewrite: maximum number of internal redirects reached. Assuming configuration error. Use 'RewriteOptions MaxRedirects' to increase the limit if neccessary.

From this I gather that /[^/]+/cgi-bin/ is matching /cgi-bin/cgiwrap, & I shouldn't think this'd be the case. Meanwhile, http://server/~user/cgi-bin/foo & other URLs cgi-bin/blah, where cgi-bin contains blah.cgi, produce Apache error: 404 Not Found, & log this error, as before:

==> error.log <==
[Wed Sep 22 21:53:54 2004] [error] [client 192.168.179.43] Negotiation: discovered file(s) matching request: /home/user/public_html/cgi-bin/foo (None could be negotiated).

<Directory />
        RewriteEngine on
        RewriteRule ^/[^/]+/cgi-bin/ /cgi-bin/cgiwrap
</Directory>

Finally, this has no effect at all, as in the first case. I checked http://server/~user/cgi-bin/foo.cgi, http://server/~user/cgi-bin/foo, & http://server/~user/cgi-bin/; instead of being redirected to cgiwrap, I got foo.cgi's source, Apache error: 404 Not Found, & ~user/public_html/cgi-bin's listing, as in the first case, just the same as without RewriteRules.

Thanks, again, for your help,

Jack




Reply to: