Re: Trailing Slash Redirect Loop Help

2019-10-15 Thread Francis Daly
On Mon, Oct 14, 2019 at 11:06:02PM -0400, Alex Med wrote: Hi there, > 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.

Re: Trailing Slash Redirect Loop Help

2019-10-14 Thread Alex Med
Dear Francis: 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. Is there a way to tell nginx that if it gets a "/" from the upstream

Re: Trailing Slash Redirect Loop Help

2019-10-14 Thread Alex Med
Dear Francis: 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. Is there a way to tell nginx that if it gets a "/" from the upstream to leave it the way it is? I guess I will give up the idea of having all ur

Re: Trailing Slash Redirect Loop Help

2019-10-09 Thread Francis Daly
On Wed, Oct 09, 2019 at 01:54:58PM -0400, Alex Med wrote: Hi there, > Here is the full configuration with reverse proxy, pagespeed,and > lowercasing. It all > works well, but now that I incorporated removing the trailing slash it > brought up new > issues: https://pastebin.com/keQ239D4. Let me k

Re: Trailing Slash Redirect Loop Help

2019-10-09 Thread Alex Med
Dear Francis: Thank you for your answers. Here is the full configuration with reverse proxy, pagespeed,and lowercasing. It all works well, but now that I incorporated removing the trailing slash it brought up new issues: https://pastebin.com/keQ239D4. Let me know if you prefer that I post the co

Re: Trailing Slash Redirect Loop Help

2019-10-08 Thread Francis Daly
On Sun, Oct 06, 2019 at 01:02:22PM -0400, Alex Med wrote: Hi there, > So, now what I want is to get rid off the trailing slashes for anything that > is not a directory or a folder (because my tomcat app seems to add a > trailing slash to it and that creates an infinite loop that does not allow >

Re: Trailing Slash Redirect Loop Help

2019-10-06 Thread Alex Med
Dear Francis: After so many years, I am back to the same questions I had many years ago, but never resolved on Nginx. So perhaps, it is time to change this and find a useful implementation. So, now what I want is to get rid off the trailing slashes for anything that is not a directory or a folde

Re: Trailing Slash Redirect Loop Help

2017-05-12 Thread Francis Daly
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

Re: Trailing Slash Redirect Loop Help

2017-05-10 Thread Alex Med
Francis - 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" Thank you so much! Alex Posted at Nginx Forum:

Re: Trailing Slash Redirect Loop Help

2017-05-10 Thread Alex Med
Steve - You are right something else is adding a trailling slash to directories. Is there a way to configure nginx to remove trailing slashes from everything except from directories? Posted at Nginx Forum: https://forum.nginx.org/read.php?2,273964,274132#msg-274132

Re: Trailing Slash Redirect Loop Help

2017-05-01 Thread Steven Hartland
My guess would be that your app is redirecting back to the slash urls Your could test this with a directory on the webserver that has a matching index file. Alternatively point a browser at the upstream and check for redirects directly On 28/04/2017 17:52, Alex Med wrote: Steven - I imple

Re: Trailing Slash Redirect Loop Help

2017-04-29 Thread Francis Daly
On Fri, Apr 28, 2017 at 10:27:12AM -0400, Alex Med wrote: Hi there, > I am having an issue getting rid of the trailing slashes for directories. I > have used the following to get rid off the trailing slash: Why do you want to get rid of the trailing slash for directories? You can do it; but yo

Re: Trailing Slash Redirect Loop Help

2017-04-28 Thread Alex Med
Steven - I implemented your suggestion and I still get the same problem with the directories ... for anything else it works. But when I try to access a directory ... I can see on the browser address bar the / appearing and disappearing and then it finally does but the browser gives this error: To

Re: Trailing Slash Redirect Loop Help

2017-04-28 Thread Steven Hartland
Yep. On 28/04/2017 16:43, Alex Med wrote: Steve - Thank you so much this has brought so much clarity! I appreciate the time you spend writing the reply. So the rewrite ^/(.*)/$ /$1 permanent; needs to be outside of the location definition and inside the server definition, correct? Infinite

Re: Trailing Slash Redirect Loop Help

2017-04-28 Thread Alex Med
Steve - Thank you so much this has brought so much clarity! I appreciate the time you spend writing the reply. So the rewrite ^/(.*)/$ /$1 permanent; needs to be outside of the location definition and inside the server definition, correct? Infinite thanks! Alex Posted at Nginx Forum: https:

Re: Trailing Slash Redirect Loop Help

2017-04-28 Thread Steven Hartland
If I understand what you're trying to do correctly, then I think you want something like: # Ensure no tailing slashes rewrite ^/(.*)/$ /$1 permanent; location @upstream { proxy_pass https://:xportNumber; proxy_set_header Host $host; proxy_set_header X-Real-IP $remo

Re: Trailing Slash Redirect Loop Help

2017-04-28 Thread Alex Med
Steveh: Thank you for your reply. So what you are suggesting me to do is something like this: location / { try_files $uri $uri/ @rewrite; } location @rewrite { rewrite ^/(.*)/$ /$1 permanent; } Put try files inside the location block and create a new block with the rewrite? Thank you

Re: Trailing Slash Redirect Loop Help

2017-04-28 Thread Steven Hartland
If is evil I'd suggest using try_files instead, which is typically something like: location / { try_files $uri $uri/ =404; } Regards Steve On 28/04/2017 15:27, Alex Med wrote: Hi, I am having an issue getting

Trailing Slash Redirect Loop Help

2017-04-28 Thread Alex Med
Hi, I am having an issue getting rid of the trailing slashes for directories. I have used the following to get rid off the trailing slash: #rewrite all URIs without any '.' in them that end with a '/' #rewrite ^([^.]*)/$ $1 permanent; & #rewrite all URIs that end with a '/'