"index off;" directive?

Maxim Dounin mdounin at mdounin.ru
Sun Apr 26 22:44:31 UTC 2026


Hello!

On Sat, Apr 25, 2026 at 09:40:35PM -0300, Fabiano Furtado wrote:

> Recently, I encountered a peculiar situation in my freenginx config
> where I needed to use autoindex to list the contents of a directory,
> but the directory contained an index.html file, causing the autoindex
> to fail.
> 
> As a workaround, I used "index file_not_found.fnf;", and it worked
> fine! However, I started thinking about the implementation of an "off"
> parameter for the index directive.
> 
> In a situation where the index file does not exist, and using
> "autoindex off;", the system returns a HTTP 403, writing "directory
> index of ".../" is forbidden" in the error_log. In other words, this
> is the default return value of freenginx when it can't find the index
> file.
> 
> In this scenario, could the "index off;" feature be implemented in freenginx?
> 
> I believe there must be solid reasons why this feature isn’t present
> yet, especially since it is an old and mandatory module in the system,
> but I can't imagine why.

I believe the main reason why this feature is not implemented yet 
is that nobody asked for it yet, probably because the workaround 
is trivial.  Also, in most cases it is better to use index rather 
than autoindex, since autoindex is costly compared to sending an 
index file.

I've asked Igor about this to make sure there are no other reasons 
I've overlooked, and he thinks the same.

I personally don't mind implementing "index off;" to save a syscall 
when checking index files is not needed.

-- 
Maxim Dounin
http://mdounin.ru/


More information about the nginx-devel mailing list