"index off;" directive?

Maxim Dounin mdounin at mdounin.ru
Tue May 12 22:16:34 UTC 2026


Hello!

On Mon, May 11, 2026 at 01:54:16PM -0300, Fabiano Furtado wrote:

> Hi!
> 
> On Sat, May 9, 2026 at 8:15 PM Maxim Dounin wrote:
> >
> > Hello!
> > [...]
> > Looking more into this, I think about only checking "off" if there
> > is only one argument.  Resulting syntax would be:
> >
> >     index off | file ...;
> >
> > With this approach,
> >
> >     index off;
> >
> > will switch off index usage, and will reject any attempts to define
> > additional indexes, so
> >
> >     index off;
> >     index index.html;
> >
> > and
> >
> >     index index.html;
> >     index off;
> >
> > will be rejected.  At the same time, when "index off;" is clearly
> > not the intention due to multiple arguments of the directive, such
> > as in
> >
> >     index index.html off on;
> >
> > or
> >
> >     index off index.html;
> >
> > all arguments would be considered index file names, exactly as it
> > works now.
> >
> > I tend to think this would be clearer from the syntax point of
> > view.
> >
> > (The patch is essentially the same, but without checking for "off"
> > in the loop.)
> >
> > What do you think?
> 
> Removing the "off" check from the loop makes the index configuration
> more flexible because it allows using "off" as an index file, although
> this is an extremely rare use case, which I think is OK. ;)

Using "off" as an index file is certainly possible with both 
variants, it just needs to be written as "./off" in some cases 
(always with the loop checks, and when it's the only argument 
otherwise).

So I believe the main difference here is how well the behaviour 
matches user expectations, most notably based on the syntax 
provided.

Committed, thanks for prodding this.

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


More information about the nginx-devel mailing list