You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Parke <pa...@gmail.com> on 2015/09/06 01:06:43 UTC

[users@httpd] undocumented silent failure of mod_autoindex (without mod_dir)

Hi,

I was adapting some old apache.conf files today.  I wanted to use
mod_autoindex, and I know it worked with these configuration files
previously (perhaps with an older version of Apache).  But I kept on
getting 404 errors instead of directory listings.

After some web searching, I found this page:

http://fabien.agranier.com/en/apache-options-indexes-ignored-by-apache-2-4/

"If you started using Apache 2.4, you may have noticed auto indexes
are not working anymore, [...] It turns out you now need to disable
DirectoryIndex in order to have auto indexes working."

DirectoryIndex itself depends on mod_dir.

So... mod_autoindex will load, its directives will parse without
error, static files will be served, yet GETting a directory will
result in a 404 error, with no details in the error log (even with
LogLevel debug) as to why mod_autoindex is not generating dynamic
indexes.

Undocumented, silent failures can be frustrating to diagnose.

Perhaps the mod_autoindex documentation could be improved to include:
1) an explicit explanation of mod_autoindex's dependency on mod_dir
and DirectoryIndex
2) a sample, minimal, functioning configuration of mod_autoindex

https://httpd.apache.org/docs/current/mod/mod_autoindex.html

(Aside: is there even any way to use mod_autoindex without mod_dir?)

Thanks!

Parke

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] undocumented silent failure of mod_autoindex (without mod_dir)

Posted by Parke <pa...@gmail.com>.
On Sat, Sep 5, 2015 at 7:09 PM, Eric Covener <co...@gmail.com> wrote:
> On Sat, Sep 5, 2015 at 9:45 PM, Eric Covener <co...@gmail.com> wrote:
>> mod_dir has some code to make up for mod_mime not having run that
>> satisfies the check in mod_autoindex.
>
> Added a fix to trunk that allows mod_autoindex to work w/o
> mod_mime/mod_dir and proposed for 2.4.x

Cool!  Thanks!

-Parke

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] undocumented silent failure of mod_autoindex (without mod_dir)

Posted by Eric Covener <co...@gmail.com>.
On Sat, Sep 5, 2015 at 9:45 PM, Eric Covener <co...@gmail.com> wrote:
> mod_dir has some code to make up for mod_mime not having run that
> satisfies the check in mod_autoindex.

Added a fix to trunk that allows mod_autoindex to work w/o
mod_mime/mod_dir and proposed for 2.4.x

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] undocumented silent failure of mod_autoindex (without mod_dir)

Posted by Eric Covener <co...@gmail.com>.
On Sat, Sep 5, 2015 at 9:29 PM, Parke <pa...@gmail.com> wrote:
> If there are nuances in my configuration file that are causing
> mod_autoindex to silently fail, I'd be happy to know what those
> nuances are.

It apparently requires mod_mime to recognize a directory is being served.

mod_dir has some code to make up for mod_mime not having run that
satisfies the check in mod_autoindex.

-- 
Eric Covener
covener@gmail.com

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] undocumented silent failure of mod_autoindex (without mod_dir)

Posted by Parke <pa...@gmail.com>.
On Sat, Sep 5, 2015 at 4:26 PM, Eric Covener <co...@gmail.com> wrote:
> On Sat, Sep 5, 2015 at 7:06 PM, Parke <pa...@gmail.com> wrote:
>> Undocumented, silent failures can be frustrating to diagnose.
>>
>> Perhaps the mod_autoindex documentation could be improved to include:
>> 1) an explicit explanation of mod_autoindex's dependency on mod_dir
>> and DirectoryIndex
>> 2) a sample, minimal, functioning configuration of mod_autoindex
>
> I think you're mis-observing something here.  The relationship is
> exactly the intiutitive relationship as its described at the top of
> mod_autoindex:
>
> http://httpd.apache.org/docs/2.4/mod/mod_autoindex.html
>
> Summary
>
> The index of a directory can come from one of two sources:
>
> * A file written by the user, typically called index.html. The
> DirectoryIndex directive sets the name of this file. This is
> controlled by mod_dir.

> * Otherwise, a listing generated by the server. The other directives
> control the format of this listing. The AddIcon, AddIconByEncoding and
> AddIconByType are used to set a list of icons to display for various
> file types; for each file listed, the first icon listed that matches
> the file is displayed. These are controlled by mod_autoindex.

It is not intuitive to me that "Otherwise" means "if (and only if)
both mod_dir is loaded and no DirectoryIndex is found".

I read "Otherwise" as meaning "if the index does not come from
mod_dir".  In my case, there were at least two good reason to believe
that the index would not come from "mod_dir".  (1) mod_dir was not
loaded.  (2) there was no "index.html" file in the requested
directory.

> mod_autoindex works without mod_dir loaded and works with mod_dir
> loaded as when you request a directory that doesn't have one of the
> named DirectoryIndex files. If it's failing for you, it's something
> more nuanced (like some other directives changing where the request is
> mapped to)

I did some more testing, and it turns out that I was partly incorrect.
Setting DirectoryIndex to disabled has no effect.  However, I still
need to load mod_dir before I get indexes from mod_autoindex.

If there are nuances in my configuration file that are causing
mod_autoindex to silently fail, I'd be happy to know what those
nuances are.

Here is the relevant configuration file in its entirety.

----

ServerName              localhost
DocumentRoot            /tmp
Listen                  8005

ErrorLog                /tmp/error
PidFile                 /tmp/pid

###  core apache 2.4
LoadModule  authn_core_module   /usr/lib/apache2/modules/mod_authn_core.so
LoadModule  authz_core_module   /usr/lib/apache2/modules/mod_authz_core.so
LoadModule  mpm_prefork_module  /usr/lib/apache2/modules/mod_mpm_prefork.so

###  auto index
LoadModule  autoindex_module    /usr/lib/apache2/modules/mod_autoindex.so
Options                 +Indexes
IndexOptions            FancyIndexing

# uncomment the next line to actiavte mod_autoindex
# LoadModule  dir_module          /usr/lib/apache2/modules/mod_dir.so

----

I am running on Ubuntu 14.04, with apache2 package version
2.4.7-1ubuntu4.5.  I am running apache2 as non-root.

Thanks!

-Parke

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] undocumented silent failure of mod_autoindex (without mod_dir)

Posted by Eric Covener <co...@gmail.com>.
On Sat, Sep 5, 2015 at 7:06 PM, Parke <pa...@gmail.com> wrote:
> Undocumented, silent failures can be frustrating to diagnose.
>
> Perhaps the mod_autoindex documentation could be improved to include:
> 1) an explicit explanation of mod_autoindex's dependency on mod_dir
> and DirectoryIndex
> 2) a sample, minimal, functioning configuration of mod_autoindex

I think you're mis-observing something here.  The relationship is
exactly the intiutitive relationship as its described at the top of
mod_autoindex:

http://httpd.apache.org/docs/2.4/mod/mod_autoindex.html

Summary

The index of a directory can come from one of two sources:

* A file written by the user, typically called index.html. The
DirectoryIndex directive sets the name of this file. This is
controlled by mod_dir.
* Otherwise, a listing generated by the server. The other directives
control the format of this listing. The AddIcon, AddIconByEncoding and
AddIconByType are used to set a list of icons to display for various
file types; for each file listed, the first icon listed that matches
the file is displayed. These are controlled by mod_autoindex.

-/-

mod_autoindex works without mod_dir loaded and works with mod_dir
loaded as when you request a directory that doesn't have one of the
named DirectoryIndex files. If it's failing for you, it's something
more nuanced (like some other directives changing where the request is
mapped to)

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org