When using a map file to rewrite a large number of locations to their destinations:
rewrite ^ $my_redirect_map permanent;
Inside the map file, some redirects look like this (including trailing slash):
/foo/ /bar;
However, if nginx receives a request without a trailing slash, e.g. http://example.com/foo then the redirect doesn't occur.
It can be worked around by including duplicates of every entry in the map file (with and without the trailing slash.)
But is there some way to instruct nginx to ignore the trailing slash when processing the rewrite? It should work the other way too, ie. if the map file says /foo and the request says /foo/ it should match.