Regex

Hi, if i have a url ending with a / how can i rewrite the request before
go to the proxy so the ending slash is dropped?

i want www.host.com/uri/ to be www.host.com/uri

Posted at Nginx Forum:

budala10 wrote:

Hi, if i have a url ending with a / how can i rewrite the request before go to the proxy so the ending slash is dropped?

rewrite ^(.*)/$ $1;

This is because in nginx you cannot substitute part of the url. The
replacement string is always considered as a whole new url. So this will
not work:

rewrite /$ “”; # DOESN’T WORK

Tobia