title: Are Content-Type Response Headers Necessary?
body: <p>I am uploading content of various types (gif, jpeg, png, css, pdf) to amazon s3.  And then I am placing Nginx in front of S3 so I can rewrite urls and have them pulled by azure cdn. </p>
  
  <p>The problem I am running into is sometimes when files are uploaded (various ways but mainly javascript http upload) we often neglect to place the content types. I am trying to figure out if its worth the time to have nginx correct these headers via a serious of location and if statements or should i just remove all content type headers all together. </p>
  
  <p>For example:
  When i look at this url in Chrome web inspector i dont see a content type header being returned. <a href="http://wiki.nginx.org/local/nginx-logo.png" rel="nofollow">http://wiki.nginx.org/local/nginx-logo.png</a>.   </p>
  
  <p>Are we finally at a point where browsers can themselves determine content types?   </p>
  
  <p>Does adding a content type header have any specific PERFORMANCE benefits?</p>
  
  <p>What would be a quick nginx rule to set a content type based on file extensions?
  For example if the url is   mydomain.com/s3reverseproxy/uploads/test.css?querystring=random to set its content type correctly?  Current I am using this but worried that a lot of if statements are probably a bad idea:</p>
  
  <pre><code>    location ~* ^/s3/(.*) {
  
  
    # Headers based on file extensions
    more_clear_headers        'Content-Type';
    if ($request_uri ~* .*svg.*) {  
      more_set_headers        "Content-Type:image/svg+xml";
      more_set_headers        "X-Content-Type:OverRidden";
    }
  
  
    set $s3_bucket           'mybucket.s3.amazonaws.com';
    set $url_full            '$1';
  
    # HEADERS
    more_set_headers          "Server: PROXYS3";
    add_header                Cache-Control "no-transform,public,max-age=36720000";
    etag                      on;
    expires                   425d;
    .....
  </code></pre>
  
  <p>Thanks!</p>