title: Nginx: How to set headers for all the files under a specific folder
body: <p>So Let's say I have my application where files are under</p>
  <p><a href="https://myapp.com/v1/assets/images/*.jpg" rel="nofollow noreferrer">https://myapp.com/v1/assets/images/*.jpg</a></p>
  <p>and</p>
  <p><a href="https://myapp.com/v1/assets/js/*.jpg" rel="nofollow noreferrer">https://myapp.com/v1/assets/js/*.jpg</a></p>
  <p>I would like to add a rule that would set no-cache headers to anything under /assets</p>
  <p>I believe what I can for now do is</p>
  <pre><code> location ~ .*assets/js/.*$ {
    add_header Cache-Control &quot;public, max-age=0, no-store&quot;;
  }
  
  location ~ .*assets/images/.*$ {
    add_header Cache-Control &quot;public, max-age=0, no-store&quot;;
  }
  </code></pre>
  <p>But that seems not working plus if I have many other folders under assets, I will need to add a separate rule.</p>
  <p>Can I group everything in a pattern so that anything under /assets/* would have that header?</p>
  <p>Thanks</p>