How to disable Service worker for specific resource?
Author: GnyblastCreated Jan 19, 2026Updated Jan 19, 2026
I'm having a API endpoint that returns text/event-stream and there's a problem with firefox browser. When I hard-reload the app it forced API to fetch from network directly and it creates and maintains the SSE. but when I reload, the request goes through the service worker and for some reason, when it's through SW, after exactly 30seconds it drops the connection saying NS_BINDING_ABORTED.
- There's no reverse-proxy, I'm testing locally.
- I have headers on response:
w.Header().Set("Content-Type", "text/event-stream")
w.Header().Set("Cache-Control", "no-store, no-cache, must-revalidate, proxy-revalidate")
w.Header().Set("Pragma", "no-cache")
w.Header().Set("Expires", "0")
w.Header().Set("X-Accel-Buffering", "no")
w.Header().Set("Connection", "keep-alive")
w.Header().Set("X-Content-Type-Options", "nosniff")- I have request headers:
req.Header.Set("Cache-Control", "no-store, no-cache")
req.Header.Set("Pragma", "no-cache")- I'm flushing response every 10 seconds
- I tried adding query parameters to the URL
and many other things that didn't help at all.
Any suggestion?
Source: maxence-charriere/go-app