title: Resource interpreted as Stylesheet but transferred with MIME type text/plain, Rails 5
body: <p>I am running a Rails 5 application on AWS and have configured the nginx with following <code>nginx.conf</code> file. 
  The problem is my application.css file is served with wrong mime type by nginx. Can someone point out what went out wrong please?</p>
  
  <p><code>/etc/nginx/nginx.conf</code></p>
  
  <pre><code>   http {
  
              include       /etc/nginx/mime.types;
              default_type  application/octet-stream;
              sendfile     on;
              tcp_nopush   on;
  
              upstream puma {
                server unix:/home/deployer/website/shared/tmp/sockets/puma.sock;
              }
  
              server {
                listen 80 default_server deferred;
                # server_name example.com;
  
                root /home/deployer/website/current/public;
                access_log /home/deployer/website/current/log/nginx.access.log;
                error_log /home/deployer/website/current/log/nginx.error.log info;
  
  
                location ~* ^/assets/ {
                  gzip_types text/plain application/x-javascript application/javascript text/css application/xml application/json;
                  gzip_static on;
                  expires max;
                  add_header Cache-Control public;
                }
  
                try_files $uri/index.html $uri @puma;
                location @puma {
                  proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
       proxy_set_header Host $http_host;
                  proxy_redirect off;
  
                  proxy_pass http://puma;
                }
  
                error_page 500 502 503 504 /500.html;
                client_max_body_size 10M;
                keepalive_timeout 10;
              }
     }
  </code></pre>
  
  <p>Update: Although, not able to get Nginx to return CSS with a correct mime type, I worked around the issue with some client-side Javascript(fix obtained from a blog for another issue). Here is the code which I put in my <code>application.js</code>.</p>
  
  <pre><code>    /* Fix for font awesome icons disappearing on reload*/
      document.addEventListener("turbolinks:before-render", function(event) {
        FontAwesome.dom.i2svg({
          node: event.data.newBody
        });
      });
  </code></pre>