Trailing Slash Redirect Loop Help

Francis Daly francis at
Fri May 12 21:25:03 UTC 2017

On Wed, May 10, 2017 at 11:10:36AM -0400, Alex Med wrote:

Hi there,

> Yes, I am realizing that is a nightmare going against the trailing-slashed
> directory nature.  So I am going to have this rule take off slashes from
> anything but directories.  Do you have any suggestions as how to do it, but
> without "if"

There's a few possibly-useful questions to consider:

Why do you want to do this?

As in: what is the problem that you want to solve? Possibly there is a
better approach than this.

Also: given that you want to do this, why do you want to do this without

Sometimes "if" is the correct tool to use.

And: what's a file and what's a directory? Your initial config
example used proxy_pass, which refers to remote urls, not files
or directories. *This* nginx does not know whether an upstream url
corresponds to a file or to something else. So that may want to be
considered before designing the solution.

Good luck with it,

Francis Daly        francis at

More information about the nginx mailing list