[Bug]: ServiceWorker cannot cache custom scheme URLs
Author: paralinCreated Jul 22, 2022Updated Sep 25, 2026
Labelsbug :beetle:stale
Preflight Checklist
- I have read the Contributing Guidelines for this project.
- I agree to follow the Code of Conduct that this project adheres to.
- I have searched the issue tracker for a bug report that matches the one I want to file, without success.
Electron Version
v19.0.9
What operating system are you using?
Other Linux
Operating System Version
Gentoo
What arch are you using?
x64
Last Known Working Electron version
No response
Expected Behavior
Register custom scheme:
electron.protocol.registerSchemesAsPrivileged([
{
'app',
privileges: {
standard: true,
secure: true,
allowServiceWorkers: true,
bypassCSP: true,
supportFetchAPI: true,
corsEnabled: true,
stream: true,
},
},
])In the Service Worker:
const cache = await self.caches.open('myCache')
const response = await fetch(request)
cache.put(request, response)Expected that the cache can store the URL.
Actual Behavior
With the url app://index.html/b/test the fetch works perfectly but cache.put returns an error:
TypeError: Failed to execute 'put' on 'Cache': Request scheme 'app' is unsupportedTestcase Gist URL
No response
Additional Information
No response
Source: electron/electron