title: Conditional declaration in Apache httpd
body: <p>We want to be able to set Cache-Control headers based on User-Agent in Apache</p>
  
  <p>For example, if a User-Agent contains substring <code>foo</code> we want to set Cache-Control to 10 minutes. But if not set it to 1 day.</p>
  
  <p>Searching around, I've found <code>BrowserMatch</code>, but that seems to only set environment variables:</p>
  
  <pre><code>BrowserMatch foo short-live  # Sets environment variable short-live
  </code></pre>
  
  <p>But I would like to conditionally apply a directive like <code>Header set ...</code> or <code>ExpiresDefault ...</code></p>
  
  <p>Is there a way to conditionally apply declarations? Something like:</p>
  
  <pre><code>&lt;FilesMatch "\.(jpg|jpeg|gif|png|js|css)$"&gt;
    Header set Cache-control "max-age=86400"
    &lt;IfBrowser "foo"&gt;
      Header set Cache-control "max-age=600"
    &lt;/IfBrowser&gt;
  &lt;/FilesMatch&gt;
  </code></pre>
  
  <p>Note, <code>IfBrowser</code> is fictional. Is there any real directive that could be used like this? Thanks!</p>