title: content-type related nginx expires header
body: <p>Is it possible to set a content-type dependent expires header in nginx? I'm quite new to nginx and tried the following:</p>
  
  <pre><code>    location ~ /files\.php$ {
      ...
              if ($content_type = "text/css") {
                      add_header X-TEST1 123;
                      expires 7d;
              }
              if ($content_type = "image/png") {
                      add_header X-TEST2 123;
                      expires 30d;
              }
              if ($content_type = "application/javascript") {
                      add_header X-TEST3 123;
                      expires 1d;
              }
              #testing
              if ($content_type != "text/css") {
                      add_header X-TEST4 abc;
              }
              #testing
              if ($content_type = text/css) {
                      add_header X-TEST5 123;
              }
      }
  </code></pre>
  
  <p>But the only header added is "X-TEST4" on all requests.
  I know about the other solution using file extension:</p>
  
  <pre><code>location ~* \.(ico|css|js|gif|jp?g|png)\?[0-9]+$
  </code></pre>
  
  <p>But it's not applicable for my application.</p>