What’s happening?
The MIME type error means that the browser tried to load a JavaScript file (like /main.js or /assets/...), but the server responded with HTML (usually your index.html). This happens when Nginx can’t find the static file and falls back to index.html due to:
try_files $uri $uri/ /index.html;
This works well for your app’s routes (like /login), but should not apply to static files
Why it works locally but fails on Azure?
Azure Web Apps sit behind a reverse proxy, and sometimes their file serving logic can be a bit different. The fact that it works in IE but fails in Chrome is because Chrome enforces strict MIME type checks, while older browsers don't.
The fix:
You need to update your nginx.conf so that static files (JS, CSS, images, fonts, etc.) are served directly, and the fallback to index.html only applies to your app routes.
server {
listen 80;
server_name _;
root /usr/share/nginx/html;
index index.html;
location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot|otf|json)$ {
try_files $uri =404;
access_log off;
expires 1y;
add_header Cache-Control "public";
}
location / {
try_files $uri $uri/ /index.html;
}
error_page 404 /index.html;
error_page 500 502 503 504 /50x.html;
}