ServerKit is a lightweight, modern server control panel for managing web applications, databases, and services on your VPS or dedicated server. Built with Python/Flask backend and React frontend.
Python astracloudflarecontrol-panelcyberpaneldnsfablehosting-control-panelhosting-panelkimi-k3server-managementserverkitubuntu-web-panelwebserver
fix(nginx): serve /serverkit-vendor/*.mjs shims as text/javascript
Juan Denisbbce447e85b4
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 933c913f..a709861a 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -24,6 +24,11 @@ Changes after 1.9.28 on the development branch.### Fixed+- Serve the runtime-extension vendor shims (`/serverkit-vendor/*.mjs`) as+ `text/javascript` from the shipped nginx vhosts. Stock nginx has no `.mjs`+ MIME entry and returned `application/octet-stream`, so every runtime-loaded+ extension (WordPress, Git, Mail, Fail2ban, ...) failed with "Failed to fetch+ dynamically imported module: blob:..." on fresh installs.- Evaluate fleet alert thresholds every minute and send opened/resolved alertsto administrators through the notification bus.- Preserve memory, disk and network measurements from agent heartbeats throughdiff --git a/frontend/nginx.conf b/frontend/nginx.confindex 0cbf93fe..baf3980b 100644--- a/frontend/nginx.conf+++ b/frontend/nginx.conf@@ -57,6 +57,21 @@ server {proxy_read_timeout 7d;}+ # Runtime-extension vendor shims (/serverkit-vendor/*.mjs). nginx builds+ # without an `.mjs` MIME entry serve application/octet-stream, which the+ # browser refuses to import as an ES module and every runtime-loaded+ # extension fails with "Failed to fetch dynamically imported module".+ # Force the type; the shims are not hashed, so they must revalidate.+ # Anchored to the shim folder: a bare `\.mjs$` regex would also capture+ # /api/v1/plugins/<slug>/assets/dist/index.mjs (regex locations beat the+ # /api prefix block) and 404 every extension bundle instead.+ location ~* ^/serverkit-vendor/.+\.mjs$ {+ types { }+ default_type text/javascript;+ try_files $uri =404;+ expires -1;+ }+# Cache static assetslocation ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot)$ {expires 1y;diff --git a/nginx/sites-available/serverkit-insecure.conf b/nginx/sites-available/serverkit-insecure.confindex 93416801..c417aca0 100644--- a/nginx/sites-available/serverkit-insecure.conf+++ b/nginx/sites-available/serverkit-insecure.conf@@ -43,6 +43,25 @@ server {add_header Cache-Control "public, immutable";}+ # Runtime-extension vendor shims (/serverkit-vendor/*.mjs). The import map in+ # index.html resolves react / react-dom / react-router-dom / i18next /+ # serverkit-sdk to these, and the browser refuses to run an ES module served+ # with a non-JavaScript MIME type. Stock nginx (1.18-1.24, Debian/Ubuntu+ # mime.types) has no `.mjs` entry and falls back to application/octet-stream,+ # which surfaces as "Failed to fetch dynamically imported module: blob:..."+ # (Chrome) or "'application/octet-stream' is not a valid JavaScript MIME+ # type" (Safari) on EVERY runtime-loaded extension. Force the type here+ # instead of editing the system mime.types. Not hashed, so revalidate.+ # Anchored to the shim folder: a bare `\.mjs$` regex would also capture+ # /api/v1/plugins/<slug>/assets/dist/index.mjs (regex locations beat the+ # /api prefix block) and 404 every extension bundle instead.+ location ~* ^/serverkit-vendor/.+\.mjs$ {+ types { }+ default_type text/javascript;+ try_files $uri =404;+ expires -1;+ }+location / {# expires -1 → Cache-Control: no-cache — the entrypoint must# revalidate every load or a cached index.html references hasheddiff --git a/nginx/sites-available/serverkit.conf b/nginx/sites-available/serverkit.confindex b09887fd..a81a86a8 100644--- a/nginx/sites-available/serverkit.conf+++ b/nginx/sites-available/serverkit.conf@@ -123,6 +123,25 @@ server {add_header Cache-Control "public, immutable";}+ # Runtime-extension vendor shims (/serverkit-vendor/*.mjs). The import map in+ # index.html resolves react / react-dom / react-router-dom / i18next /+ # serverkit-sdk to these, and the browser refuses to run an ES module served+ # with a non-JavaScript MIME type. Stock nginx (1.18-1.24, Debian/Ubuntu+ # mime.types) has no `.mjs` entry and falls back to application/octet-stream,+ # which surfaces as "Failed to fetch dynamically imported module: blob:..."+ # (Chrome) or "'application/octet-stream' is not a valid JavaScript MIME+ # type" (Safari) on EVERY runtime-loaded extension. Force the type here+ # instead of editing the system mime.types. Not hashed, so revalidate.+ # Anchored to the shim folder: a bare `\.mjs$` regex would also capture+ # /api/v1/plugins/<slug>/assets/dist/index.mjs (regex locations beat the+ # /api prefix block) and 404 every extension bundle instead.+ location ~* ^/serverkit-vendor/.+\.mjs$ {+ types { }+ default_type text/javascript;+ try_files $uri =404;+ expires -1;+ }+location / {# expires -1 (not add_header): emits Cache-Control: no-cache without# discarding the server-level security headers, and forces every load