Trailing Slash Redirect Loop Help
francis at daoine.org
Tue Oct 15 14:34:09 UTC 2019
On Mon, Oct 14, 2019 at 11:06:02PM -0400, Alex Med wrote:
> What I am perceiving from your answers is that if nginx can not know with
> (!-d or the try_files) that the uri is a directory or a file, there is not
> much it can do about not removing slashes from the uris it gets.
Correct. More specifically: there is not much nginx can do about removing
slashes based on whether the uri corresponds to a file or directory on
a server that nginx cannot read.
> Is there a way to tell nginx that if it gets a "/" from the upstream to
> leave it the way it is?
I don't understand the question.
nginx will usually leave things the way they are, unless configured
otherwise. (Aside: some default configuration options are "do change
If it still matters, can you describe a timeline of what you would like
to have happen?
* client requests /thing/
* nginx (does something, perhaps involving the filesystem or a
* nginx responds http 301 to /thing, or responds 200 with some content. Or
maybe responds http 301 to /thing/index?
but include all the words at step 2 that will make it very clear what
your desired end result is.
> I guess I will give up the idea of having all urls
> without a trailing slash.
You can do "no trailing slash" if you want to; but you will have to
configure all of your web servers to do what you want them to when they
get a "trailing slash" url.
I don't think that I know what you want them to do when they get a
"trailing slash" url.
Good luck with it,
Francis Daly francis at daoine.org
More information about the nginx