title: Refused to apply style from css because its MIME type ('text/html') is not a supported stylesheet MIME type,
body: <p>I keep getting the error:</p>
  <blockquote>
  <p>Refused to apply style from 'https://mysitenet/static/css/main.a617e044.chunk.css' because its MIME type ('text/html') is not a supported stylesheet MIME type, and strict MIME checking is enabled.</p>
  </blockquote>
  <blockquote>
  <p>Failed to load resource: the server responded with a status of 503 ()</p>
  </blockquote>
  <p>I have gone through several <a href="https://stackoverflow.com/questions/48248832/stylesheet-not-loaded-because-of-mime-type">SO</a> <a href="https://stackoverflow.com/questions/48248832/stylesheet-not-loaded-because-of-mime-type">posts</a> which suggest to include js, css in my nginx location .</p>
  <p>I followd all those steps, but still unable to resolve the error.</p>
  <p>My nginx config is this :</p>
  <pre><code>#user  nobody;
  
  worker_processes auto;
  
  #error_log  logs/error.log;
  #error_log  logs/error.log  notice;
  #error_log  logs/error.log  info;
  
  #pid        logs/nginx.pid;
  
  events {
      worker_connections  1024;
  }
  
  
  http {
      # what mime-type to include
      include       /etc/nginx/mime.types;
      # what is the default one
      default_type  application/octet-stream;
  
  
     # Sets the path, format, and configuration for a buffered log write
      log_format compression '$remote_addr - $remote_user [$time_local] '
          '&quot;$request&quot; $status $upstream_addr '
          '&quot;$http_referer&quot; &quot;$http_user_agent&quot;';
  
      sendfile            on;
      keepalive_timeout   10;
      send_timeout        10;
      server_tokens       off;
  
      # todo: latest nginx release does not bundle gzip
      #gzip_proxied        any;
      #gzip_min_length     1000;
      #gzip_types          *;
  
      rewrite_log on;
  
      server {
          listen 80 default_server;
         server_name _;
         return 301 https://$host$request_uri;
      }
  
      server {
  
          listen 443 http2 ssl;
          #listen 443 ssl;
  
  
           server_name         localhost *.localhost 
   *.amazonaws.com mydomain.net *.mydomain.net;
  
          access_log /var/log/nginx/access.log compression;
  
          root   /usr/share/nginx/html;
          
          # what file to server as index
          index index.html index.htm;
  
          ssl_certificate     ssl/nginx.crt;
          ssl_certificate_key ssl/nginx.key;
          ssl_dhparam                 ssl/dhparam.pem;
  
          ssl_session_cache           shared:SSL:1m;
          ssl_session_tickets         off;
          ssl_session_timeout         5m;
          ssl_ciphers                 ALL:!EXP:!NULL:!ADH:!LOW:!SSLv2:!SSLv3:!MD5:!RC4;
          ssl_prefer_server_ciphers   on;
          ssl_protocols               TLSv1.2;
  
          location / {                
              try_files $uri /index.html;
          }
  
          # Media: images, icons, video, audio, HTC
          location ~* \.(?:jpg|jpeg|gif|png|ico|cur|gz|svg|svgz|mp4|ogg|ogv|webm|htc)$ {
            expires 1M;
            access_log off;
            add_header Cache-Control &quot;public&quot;;
          }
  
          # Javascript and CSS files
          location ~* \.(?:css|js)$ {
              try_files $uri =404;
              expires 1y;
              access_log off;
              add_header Cache-Control &quot;public&quot;;
          }
  
          # Any route containing a file extension (e.g. /devicesfile.js)
          location ~ ^.+\..+$ {
              try_files $uri =404;
          }
  
      }
  
  }
  </code></pre>
  <p>I am creating a nginx container, using docker file and then deploying on AWS cluster.</p>
  <pre><code>FROM nginx
  
  ADD ./nginx.conf /etc/nginx/nginx.conf
  
  RUN mkdir -p /etc/nginx/ssl
  
  
  RUN openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
  RUN openssl req -x509 -sha256 -nodes -days 3650 -newkey rsa:2048 -keyout /etc/nginx/ssl/nginx.key -out /etc/nginx/ssl/nginx.crt -subj &quot;/C=AU/ST=VIC/L=Melbourne/O=3Ssomething Net /CN=3something.net&quot;
  
  
  
  EXPOSE 80 443
  
  COPY ./build/ /usr/share/nginx/html     
  </code></pre>
  <p>The docker file is, copying the build output (<code>yarn build</code>) to nginx html folder.</p>
  <p>Everything works, but not sure , whats the issue with mimetype and why nginx is not serving the /static/css and /static/js/ files inside my &quot;build&quot; folder.</p>