try_files doubleslash mystery

Maik Beckmann beckmann.maik at googlemail.com
Sun Aug 18 09:40:59 UTC 2019


Am Sa., 17. Aug. 2019 um 20:04 Uhr schrieb Francis Daly <francis at daoine.org>:
> """
> The path to a file is constructed from the file parameter according to
> the root and alias directives. It is possible to check directory’s
> existence by specifying a slash at the end of a name, e.g. “$uri/”.
> """
>
> $foo does not end in slash, so try_files looks for a file of that
> (expanded) name, and fails to find it.
>
> $foo/ does end in slash, so try_files looks for a directory of that
> (expanded) name, and finds it and serves it (which involves a
> subrequest/internal redirect).
>

Thank you for your answer, Francis.

I've read the quoted documentation about try_files before.  That it
searches for an directory with $uri/ .  I did not understand that it
isn't about the content of the variable, but only about the appended
slash.  Thank you.

What I still don't understand is how the existence of an directory
results in subrequest/internal redirect.  Is that documented
somewhere?

Have a good Sunday.

Regards
Maik Beckmann

PS: It has been years since I've used mailing lists.  I do not trust
GMail to handle it properly nowadays.  It used to "just work".  Sorry
if I mess up.


More information about the nginx mailing list