#35033·electron

[Bug]: ServiceWorker cannot cache custom scheme URLs

Author: paralinCreated Jul 22, 2022Updated Sep 25, 2026
Labelsbug :beetle:stale

Preflight Checklist

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 unsupported

Testcase Gist URL

No response

Additional Information

No response