F
Filament2y ago
vas

MIME type ('text/html') is not executable, and strict MIME type checking is enabled

ps://arknext.io/filament/assets/app.js?id=9cf00a680eed0bca655a7d74a5f4ce67 net::ERR_ABORTED 404 admin:1 Refused to execute script from 'https://arknext.io/filament/assets/app.js?id=9cf00a680eed0bca655a7d74a5f4ce67' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled. any idea why i get this in production , im using nginx
27 Replies
vas
vasOP2y ago
this is mime.types
vas
vasOP2y ago
this only happens in chrome , firefox seems fine
Dennis Koch
Dennis Koch2y ago
JS is returned with mime type text/html. You probably just need to add a mime type for JS
vas
vasOP2y ago
is there isn't it ? application/javascript js;
Dan Harrin
Dan Harrin2y ago
check the default forge nginx config because it works out of the box with all official laravel environments
vas
vasOP2y ago
is that something that is public ?
Dennis Koch
Dennis Koch2y ago
Ah, sorry. Search didn't work 🤦🏼‍♂️ Seems like it isn't applied properly. Did you adjust anything? If yes: Did you restart nginx?
vas
vasOP2y ago
i didn't change anything this is the entry in the nginx.cfg
# MIME
include mime.types;
default_type application/octet-stream;
# MIME
include mime.types;
default_type application/octet-stream;
Dan Harrin
Dan Harrin2y ago
this is the forge config for demo.filamentphp.com
# FORGE CONFIG (DO NOT REMOVE!)
include forge-conf/demo.filamentphp.com/before/*;

server {
listen 80;
listen [::]:80;
server_name demo.filamentphp.com;
server_tokens off;
root /home/forge/demo.filamentphp.com/public;

# FORGE SSL (DO NOT REMOVE!)
# ssl_certificate
# ssl_certificate_key

ssl_protocols TLSv1.2 TLSv1.3;
ssl_ciphers ...
ssl_prefer_server_ciphers off;
ssl_dhparam /etc/nginx/dhparams.pem;

add_header X-Frame-Options "SAMEORIGIN";
add_header X-XSS-Protection "1; mode=block";
add_header X-Content-Type-Options "nosniff";

index index.html index.htm index.php;

charset utf-8;

# FORGE CONFIG (DO NOT REMOVE!)
include forge-conf/demo.filamentphp.com/server/*;

location / {
try_files $uri $uri/ /index.php?$query_string;
}

location = /favicon.ico { access_log off; log_not_found off; }
location = /robots.txt { access_log off; log_not_found off; }

access_log off;
error_log /var/log/nginx/demo.filamentphp.com-error.log error;

error_page 404 /index.php;

location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php/php8.1-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
}

location ~ /\.(?!well-known).* {
deny all;
}
}

# FORGE CONFIG (DO NOT REMOVE!)
include forge-conf/demo.filamentphp.com/after/*;
# FORGE CONFIG (DO NOT REMOVE!)
include forge-conf/demo.filamentphp.com/before/*;

server {
listen 80;
listen [::]:80;
server_name demo.filamentphp.com;
server_tokens off;
root /home/forge/demo.filamentphp.com/public;

# FORGE SSL (DO NOT REMOVE!)
# ssl_certificate
# ssl_certificate_key

ssl_protocols TLSv1.2 TLSv1.3;
ssl_ciphers ...
ssl_prefer_server_ciphers off;
ssl_dhparam /etc/nginx/dhparams.pem;

add_header X-Frame-Options "SAMEORIGIN";
add_header X-XSS-Protection "1; mode=block";
add_header X-Content-Type-Options "nosniff";

index index.html index.htm index.php;

charset utf-8;

# FORGE CONFIG (DO NOT REMOVE!)
include forge-conf/demo.filamentphp.com/server/*;

location / {
try_files $uri $uri/ /index.php?$query_string;
}

location = /favicon.ico { access_log off; log_not_found off; }
location = /robots.txt { access_log off; log_not_found off; }

access_log off;
error_log /var/log/nginx/demo.filamentphp.com-error.log error;

error_page 404 /index.php;

location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php/php8.1-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
}

location ~ /\.(?!well-known).* {
deny all;
}
}

# FORGE CONFIG (DO NOT REMOVE!)
include forge-conf/demo.filamentphp.com/after/*;
we havent changed anything
vas
vasOP2y ago
ok let me dig in thanks
Dennis Koch
Dennis Koch2y ago
Is this inside the http section?
vas
vasOP2y ago
my config is pretty much the same i found this post here
vas
vasOP2y ago
Gist
Modified Nginx configuration file for servers provisioned by Larave...
Modified Nginx configuration file for servers provisioned by Laravel Forge - nginx.conf
vas
vasOP2y ago
that has this extra bit in nginx.cfg Update charset_types due to updated mime.types charset_types text/xml text/plain text/vnd.wap.wml application/x-javascript application/rss+xml text/css application/javascript application/json; now the only error im getting is
ps://arknext.io/filament/assets/app.js?id=9cf00a680eed0bca655a7d74a5f4ce67 net::ERR_ABORTED 404
ps://arknext.io/filament/assets/app.js?id=9cf00a680eed0bca655a7d74a5f4ce67 net::ERR_ABORTED 404
Dennis Koch
Dennis Koch2y ago
Oh. So the issue wasn't that it send the wrong mime type, but that it sent a 404 and therefore not JS but an HTML error message
vas
vasOP2y ago
yea sry i should've put that in as well
Dennis Koch
Dennis Koch2y ago
Do you have this line in your nginx config? Because the request for the JS file must be routed through Laravel.
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location / {
try_files $uri $uri/ /index.php?$query_string;
}
Dennis Koch
Dennis Koch2y ago
Hm. Weird since it works with livewire.js but not with Filament JS
vas
vasOP2y ago
could it be something from cloudflare
Dennis Koch
Dennis Koch2y ago
That's what I just thought. But still weird if it works with livewire.js
vas
vasOP2y ago
hmm i disabled the proxy in the dns settings on cloudflare and enabled it again purge chrome cache its working now
vas
vasOP2y ago
no errors 🙂
Dennis Koch
Dennis Koch2y ago
Nice 👌🏼
vas
vasOP2y ago
thanks for your help
Want results from more Discord servers?
Add your server