Repository: traefik/traefik (language: go)

Issue:
Dashboard JS  blocked because of a disallowed MIME type (“text/plain”)
### Welcome!

- [X] Yes, I've searched similar issues on [GitHub](https://github.com/traefik/traefik/issues) and didn't find any.
- [X] Yes, I've searched similar issues on the [Traefik community forum](https://community.traefik.io) and didn't find any.

### What did you do?

Loaded dashboard, viewed developer panel and see console and network requests

### What did you see instead?

Noticed blocked content in console and network traffic:

`
Loading module from “http://127.0.0.1:8080/dashboard/assets/_hacks.de068122.js” was blocked because of a disallowed MIME type (“text/plain”).
[dashboard](http://127.0.0.1:8080/dashboard/#/)
Loading module from “http://127.0.0.1:8080/dashboard/assets/_init.a396cff6.js” was blocked because of a disallowed MIME type (“text/plain”).
[dashboard](http://127.0.0.1:8080/dashboard/#/)
Loading failed for the module with source “http://127.0.0.1:8080/dashboard/assets/_hacks.de068122.js”. [dashboard:1:1022](http://127.0.0.1:8080/dashboard/#/)
Loading failed for the module with source “http://127.0.0.1:8080/dashboard/assets/_init.a396cff6.js”.
`

### What version of Traefik are you using?

3.0.3


### What is your environment & configuration?

Ubuntu 24.04 / Firefox 127.0


### If applicable, please paste the log output in DEBUG level

_No response_


Discussion / hints:
Hello @ziqbal,

Thanks for your interest in Traefik!

As mentioned in [the migration guide](https://doc.traefik.io/traefik/migration/v2-to-v3-details/#content-type-auto-detection):

```
In v3, the Content-Type header is not auto-detected anymore when it is not set by the backend. One should use the ContentType middleware to enable the Content-Type header value auto-detection.
```

Did you try to use the content-type middleware?

@rtribotte Maybe I was not clear - the console logs are for the builtin traefik dashboard.
Other internal js files are loaded fine without errors.
Any new regarding this issue ? I'm encountering the same issue, even through, there is not problem navigating in the Dashboard.

My setup for the dashboard is as follows (dynamic traefik.yml conffile):

```yaml
http:
  middlewares:
    authentication:
      basicAuth:
        users:
          - 'l.declercq@konzeptplus.ch:$apr1$<passwordhash>'
    gzip:
      compress: true
    redirect-to-https:
      redirectScheme:
        scheme: https
    traefik-dashboard-https:
      chain:
        middlewares:
          - authentication
          - gzip
  routers:
    traefik-dashboard-http:
      entryPoints:
        - http
      middlewares:
        - redirect-to-https
      rule: Host(`traefik.srv01.konzeptplus-preview.ch`)
      service: api@internal
    traefik-dashboard-https:
      entryPoints:
        - https
      middlewares:
        - traefik-dashboard-https
      rule: Host(`traefik.srv01.konzeptplus-preview.ch`)
      service: api@internal
      tls:
        certResolver: letsencrypt
```

The errors in my FF console :
![Capture d’écran 2024-08-03 à 18 38 48](https://github.com/user-attachments/assets/3976d8b1-c7fa-4608-aa9d-ead814fc04a9)


Fix patch:
diff --git a/webui/embed.go b/webui/embed.go
index 155b0f9e64..23159dc1fb 100644
--- a/webui/embed.go
+++ b/webui/embed.go
@@ -5,6 +5,8 @@ import (
 	"io/fs"
 )
 
+// Files starting with . and _ are excluded by default
+//
 //go:embed static
 var assets embed.FS
 
diff --git a/webui/package.json b/webui/package.json
index f0521e8f0f..0a8d12eacf 100644
--- a/webui/package.json
+++ b/webui/package.json
@@ -20,16 +20,13 @@
   "dependencies": {
     "@quasar/extras": "^1.16.12",
     "axios": "^1.7.4",
-    "bowser": "^2.11.0",
     "chart.js": "^4.4.1",
     "core-js": "^3.35.1",
     "dot-prop": "^8.0.2",
-    "iframe-resizer": "^4.3.9",
     "lodash.isequal": "4.5.0",
     "moment": "^2.30.1",
     "quasar": "^2.16.6",
     "query-string": "^8.1.0",
-    "vh-check": "^2.0.5",
     "vue": "^3.0.0",
     "vue-chartjs": "^5.3.0",
     "vue-router": "^4.0.12",
diff --git a/webui/quasar.conf.js b/webui/quasar.conf.js
index 58a8e2c39c..c4a41a8c0c 100644
--- a/webui/quasar.conf.js
+++ b/webui/quasar.conf.js
@@ -13,9 +13,7 @@ module.exports = configure(function (ctx) {
     // app boot file (/src/boot)
     // --> boot files are part of "main.js"
     boot: [
-      'api',
-      '_hacks',
-      '_init'
+      'api'
     ],
 
     css: [
diff --git a/webui/src/_directives/resize.js b/webui/src/_directives/resize.js
deleted file mode 100644
index 3a0500a448..0000000000
--- a/webui/src/_directives/resize.js
+++ /dev/null
@@ -1,16 +0,0 @@
-import iframeResize from 'iframe-resizer/js/iframeResizer'
-
-const resize = {
-  mounted (el, binding) {
-    const options = binding.value || {}
-    el.addEventListener('load', () => iframeResize(options, el))
-  },
-  unmounted (el) {
-    const resizableEl = el
-    if (resizableEl.iFrameResizer) {
-      resizableEl.iFrameResizer.removeListeners()
-    }
-  }
-}
-
-export default resize
diff --git a/webui/src/boot/_globals.js b/webui/src/boot/_globals.js
deleted file mode 100644
index f099d03cd6..0000000000
--- a/webui/src/boot/_globals.js
+++ /dev/null
@@ -1,10 +0,0 @@
-import { APP } from '../_helpers/APP'
-import Boot from '../_middleware/Boot'
-
-export default async ({ app, router, store }) => {
-  app.use(Boot)
-
-  APP.root = app
-  APP.router = router
-  APP.store = store
-}
diff --git a/webui/src/boot/_hacks.js b/webui/src/boot/_hacks.js
deleted file mode 100644
index 2d63bbdd04..0000000000
--- a/webui/src/boot/_hacks.js
+++ /dev/null
@@ -1,13 +0,0 @@
-import Bowser from 'bowser'
-import vhCheck from 'vh-check'
-
-const browser = Bowser.getParser(window.navigator.userAgent)
-
-// In Mobile
-if (browser.getPlatform().type === 'mobile') {
-  vhCheck()
-}
-
-export default async ({ app, Vue }) => {
-
-}
diff --git a/webui/src/boot/_init.js b/webui/src/boot/_init.js
deleted file mode 100644
index 5ec3caf4e3..0000000000
--- a/webui/src/boot/_init.js
+++ /dev/null
@@ -1,30 +0,0 @@
-import { APP } from '../_helpers/APP'
-import errors from '../_helpers/Errors'
-import resize from '../_directives/resize'
-
-export default async ({ app, router }) => {
-  // Directives
-  app.directive('resize', resize)
-
-  // Router
-  // ----------------------------------------------
-  router.beforeEach(async (to, from, next) => {
-    // Set APP
-    APP.routeTo = to
-    APP.routeFrom = from
-    next()
-  })
-
-  // Api (axios)
-  // ----------------------------------------------
-  APP.api.interceptors.request.use((config) => {
-    console.log('interceptors -> config', config)
-    // config.headers['Accept'] = '*/*'
-    return config
-  })
-
-  APP.api.interceptors.response.use((response) => {
-    console.log('interceptors -> response', response)
-    return response
-  }, errors.handleResponse)
-}
diff --git a/webui/yarn.lock b/webui/yarn.lock
index 88b6bac4fe..c9eb682333 100644
--- a/webui/yarn.lock
+++ b/webui/yarn.lock
@@ -2267,11 +2267,6 @@ boolbase@^1.0.0:
   resolved "https://registry.yarnpkg.com/boolbase/-/boolbase-1.0.0.tgz#68dff5fbe60c51eb37725ea9e3ed310dcc1e776e"
   integrity sha512-JZOSA7Mo9sNGB8+UjSgzdLtokWAky1zbztM3WRLCbZ70/3cTANmQmOdR7y2g+J0e2WXywy1yS468tY+IruqEww==
 
-bowser@^2.11.0:
-  version "2.11.0"
-  resolved "https://registry.yarnpkg.com/bowser/-/bowser-2.11.0.tgz#5ca3c35757a7aa5771500c70a73a9f91ef420a8f"
-  integrity sha512-AlcaJBi/pqqJBIQ8U9Mcpc9i8Aqxn88Skv5d+xBX006BY5u8N3mGLHa5Lgppa7L/HfwgwLgZ6NYs+Ag6uUmJRA==
-
 brace-expansion@^1.1.7:
   version "1.1.11"
   resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.11.tgz#3c7fcbf529d87226f3d2f52b966ff5271eb441dd"
@@ -3864,11 +3859,6 @@ ieee754@^1.1.13, ieee754@^1.2.1:
   resolved "https://registry.yarnpkg.com/ieee754/-/ieee754-1.2.1.tgz#8eb7a10a63fff25d15a57b001586d177d1b0d352"
   integrity sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==
 
-iframe-resizer@^4.3.9:
-  version "4.4.5"
-  resolved "https://registry.yarnpkg.com/iframe-resizer/-/iframe-resizer-4.4.5.tgz#f5048636e7f2fb5d9a09cc2ae78eb2da55ad555c"
-  integrity sha512-U8bCywf/Gh07O69RXo6dXAzTtODQrxaHGHRI7Nt4ipXsuq6EMxVsOP/jjaP43YtXz/ibESS0uSVDN3sOGCzSmw==
-
 ignore@^5.2.0, ignore@^5.2.4:
   version "5.3.1"
   resolved "https://registry.yarnpkg.com/ignore/-/ignore-5.3.1.tgz#5073e554cd42c5b33b394375f538b8593e34d4ef"
@@ -6007,11 +5997,6 @@ vary@~1.1.2:
   resolved "https://registry.yarnpkg.com/vary/-/vary-1.1.2.tgz#2299f02c6ded30d4a5961b0b9f74524a18f634fc"
   integrity sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==
 
-vh-check@^2.0.5:
-  version "2.0.5"
-  resolved "https://registry.yarnpkg.com/vh-check/-/vh-check-2.0.5.tgz#1b70610461e9776176f23d172daae3c4761aed09"
-  integrity sha512-vHtIYWt9uLl2P2tLlatVpMwv9+ezuJCtMNjUVIpzd5Pa/dJXN8AtqkKmVRcNSlmXyCjkCkbMQX/Vs9axmdlfgg==
-
 vite-jsconfig-paths@^2.0.1:
   version "2.0.1"
   resolved "https://registry.yarnpkg.com/vite-jsconfig-paths/-/vite-jsconfig-paths-2.0.1.tgz#d66e36d67596dd8a8e4a6ed6e6db20debc50b45e"


Test patch: