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:
http://forum.nginx.org/read.php?2,55377,55377#msg-55377

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

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs