Bug 62882 - DirectoryIndex arguments match prefix of filenames, not exact filenames
Summary: DirectoryIndex arguments match prefix of filenames, not exact filenames
Alias: None
Product: Apache httpd-2
Classification: Unclassified
Component: mod_dir (show other bugs)
Version: 2.4.25
Hardware: PC Linux
: P2 minor (vote)
Target Milestone: ---
Assignee: Apache HTTPD Bugs Mailing List
Depends on:
Reported: 2018-11-04 06:57 UTC by Björn Wiberg
Modified: 2018-11-04 08:42 UTC (History)
1 user (show)


Note You need to log in before you can comment on or make changes to this bug.
Description Björn Wiberg 2018-11-04 06:57:04 UTC
The arguments given to DirectoryIndex, when one specifies filenames, appear to specify *prefixes* of what mod_dir should be looking for rather than exact filenames.

If you, for example, have:

DirectoryIndex index.php index.pl index.cgi index.phtml index.shtml index.xhtml index.html.var index.html index.htm default.php

...and then add a GIF file called "index.html.gif" to an autoindexed directory, Apache appears to happily serve that GIF file as the directory index, although DirectoryIndex only specifies "index.html".

Other configurations options in effect (for reference, in case they would influence):

IndexOptions FancyIndexing VersionSort HTMLTable NameWidth=* DescriptionWidth=* Charset=UTF-8
IndexOptions +FoldersFirst -HTMLTable +IconHeight +IconWidth +IgnoreCase +ScanHTMLTitles
IndexOptions +UseOldDateFormat

...and for mod_negotiation:

LanguagePriority en ca cs da de el eo es et fr he hr it ja ko ltz nl nn no pl pt pt-BR ru sv tr zh-CN zh-TW
ForceLanguagePriority Prefer Fallback

...and for core:

Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec
Comment 1 Christophe JAILLET 2018-11-04 08:42:07 UTC
This not a bug.

Have a look at:

It explains the way 'MultiViews' works. (especially "MultiViews may also apply to searches for the file named by the DirectoryIndex directive, if the server is trying to index a directory.")