title: nginx trailing slash rewrite results in a redirect loop
body: <p>I'm using nginx for the first time and I can't seem to figure this out. I'm trying to rewrite my nginx config so that all of my URLs no longer have the trailing slash that nginx defaults to. </p>
  
  <p>I've been trying the following, but it still results in a redirect loop ("Firefox has detected that the server is redirecting the request for this address in a way that will never complete."):</p>
  
  <pre><code>    server_name_in_redirect off;
      rewrite ^/(.*)/$ /$1 permanent;
  </code></pre>
  
  <p>Any ideas on what might be going wrong here and how I can remove trailing slashes?</p>