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 to leave it the way it is? I guess I will give up the idea of having all urls withoutby Alex Med - Nginx Mailing List - English
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 urls without a trailing slash. Regards, Alex P.S. I will look into having the APby Alex Med - Nginx Mailing List - English
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 configurations in the post. Here are the answers to your questions: As stated before the &by Alex Med - Nginx Mailing List - English
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 folder (because my tomcat app seems to add a trailing slash to it and that creates an infinite loop thby Alex Med - Nginx Mailing List - English
Francis, I apologized. I wrote your name incorrectly in my previous message. I am not able to edit it. So, THANK YOU, FRANCIS! Alexby Alex Med - Nginx Mailing List - English
Dear David: I am very grateful for your help! Below is the final configuration working optimally. I even included the proxy configuration parameters for the websocket connection to work.I noticed that the location =/ does not support OR so I had create two additional locations to catch paths without the end forward slash. Is there a limit in the number of location that a configuration filby Alex Med - Nginx Mailing List - English
Dear Francis: Thank you again for your help! I apologize. Perhaps, I should have started with what I want to accomplish with the configuration. I want the server to lowercased every URI except the ones that begins with any of the following paths: /api/ /contentAsset/ /categoriesServlet/ /DotAjaxDirector/ /html/ /dwr/ /dA/ /JsonTag/ Most of the above paths belong to a protecby Alex Med - Nginx Mailing List - English
I also would like to add that when I access: example.com/API/ it is lowercased to example.com/api/. According to my configuration it should not. So it means location #1 is not working properly. Alex Med Wrote: ------------------------------------------------------- > Dear Francis: > > Here are the answers to your questions. Thank YOU for helping! > > The locationby Alex Med - Nginx Mailing List - English
Dear Francis: Here are the answers to your questions. Thank YOU for helping! The location block are in the following order: Location #1 location ~ ^/(api|contentAsset|categoriesServlet|DotAjaxDirector|html|dwr|dA)/ {} Location #2 ----> This location does the lowercasing location ~ { return 301 $scheme://$host$my_uri_to_lowercase;} Location #3 location /{} Everything is loby Alex Med - Nginx Mailing List - English
I have the following server configuration. I have two problems that I would appreciate if someone can tell me what I am doing wrong: 1- this location is not respected since the configuration lowercases all uris without respecting these locations. Please note that api, contentAssets, categoryServlet are paths, not directories or folders. location ~ ^/(api|contentAsset|categoriesServlet|DotAby Alex Med - Nginx Mailing List - English
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! Alexby Alex Med - Nginx Mailing List - English
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?by Alex Med - Nginx Mailing List - English
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: Too many redirects occurred trying to open https://xxxx.com/xxx". This might occur if you opeby Alex Med - Nginx Mailing List - English
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! Alexby Alex Med - Nginx Mailing List - English
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 for the clarification!by Alex Med - Nginx Mailing List - English
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 '/' rewrite ^/(.*)/$ /$1 permanent; They both work, but they do not when it comes to dirby Alex Med - Nginx Mailing List - English