Skip to content

Node.js based forum software built for the modern web

fix: #9151, dont use service worker for posts requests

Barış Soner Uşaklı20c1b684ed9a
diff --git a/public/src/service-worker.js b/public/src/service-worker.js
index 57a2243742..babbf24f19 100644
--- a/public/src/service-worker.js
+++ b/public/src/service-worker.js
@@ -1,6 +1,14 @@
'use strict';
self.addEventListener('fetch', function (event) {
+ // This is the code that ignores post requests
+ // https://github.com/NodeBB/NodeBB/issues/9151
+ // https://github.com/w3c/ServiceWorker/issues/1141
+ // https://stackoverflow.com/questions/54448367/ajax-xmlhttprequest-progress-monitoring-doesnt-work-with-service-workers
+ if (event.request.method === 'POST') {
+ return;
+ }
+
event.respondWith(caches.match(event.request).then(function (response) {
if (!response) {
return fetch(event.request);