diff --git a/config/cms.php b/config/cms.php
index 75189b297..a2b2fb5af 100644
--- a/config/cms.php
+++ b/config/cms.php
@@ -413,4 +413,26 @@ return [
'restrictBaseDir' => true,
+ /*
+ |--------------------------------------------------------------------------
+ | Backend Service Worker
+ |--------------------------------------------------------------------------
+ |
+ | Allow plugins to run Service Workers in the backend.
+ |
+ | WARNING: This should always be disabled for security reasons as Service
+ | Workers can be hijacked and used to run XSS into the backend. Turning
+ | this feature on can create a conflict if you have a frontend Service
+ | Worker running. The 'scope' needs to be correctly set and not have a
+ | duplicate subfolder structure on the frontend, otherwise it will run
+ | on both the frontend and backend of your website.
+ |
+ | true - allow service workers to run in the backend
+ |
+ | false - disallow service workers to run in the backend
+ |
+ */
+
+ 'enableBackendServiceWorkers' => false,
+
];
diff --git a/modules/backend/assets/js/auth/uninstall-sw.js b/modules/backend/assets/js/auth/uninstall-sw.js
deleted file mode 100644
index eb48b3938..000000000
--- a/modules/backend/assets/js/auth/uninstall-sw.js
+++ /dev/null
@@ -1,10 +0,0 @@
-// Only run on HTTPS connections
-if (location.protocol === 'https:') {
- // Unregister all service workers before signing in to prevent cache issues
- navigator.serviceWorker.getRegistrations().then(
- function(registrations) {
- for (let registration of registrations) {
- registration.unregister();
- }
- });
-}
\ No newline at end of file
diff --git a/modules/backend/controllers/Auth.php b/modules/backend/controllers/Auth.php
index 42f80bcf7..efb120ba9 100644
--- a/modules/backend/controllers/Auth.php
+++ b/modules/backend/controllers/Auth.php
@@ -46,8 +46,6 @@ class Auth extends Controller
})->only('signout');
}
- // Add JS File to un-install SW to avoid Cookie Cache Issues when Signin, see github issue: #3707
- $this->addJs(url("/modules/backend/assets/js/auth/uninstall-sw.js"));
$this->layout = 'auth';
}
diff --git a/modules/backend/layouts/_head.htm b/modules/backend/layouts/_head.htm
index 0edbc4803..68033f741 100644
--- a/modules/backend/layouts/_head.htm
+++ b/modules/backend/layouts/_head.htm
@@ -39,6 +39,24 @@
+
+
+
+
= $this->makeAssets() ?>
= Block::placeholder('head') ?>
= $this->makeLayoutPartial('custom_styles') ?>
diff --git a/modules/backend/layouts/auth.htm b/modules/backend/layouts/auth.htm
index 6f7bc0ec4..e28b2e555 100644
--- a/modules/backend/layouts/auth.htm
+++ b/modules/backend/layouts/auth.htm
@@ -37,6 +37,24 @@
+
+
+
+
= $this->makeAssets() ?>
= Block::placeholder('head') ?>
= $this->makeLayoutPartial('custom_styles') ?>