How can we use protocol.interceptFileProtocol with only certain paths, leaving other requests untouched?


I’d like to intercept certain HTTP requests and manually load files from the file system as the responses.

So I thought I could use protocol.interceptFileProtocol like so:

protocol.interceptFileProtocol('http', (request, callback) => {
  // intercept only requests to ""
  if (request.url.startsWith("")) {

  // otherwise, let the HTTP request behave like normal.
  // But how?

But how do we allow other http requests other than to continue working like before?

EDIT: This looks like a duplicate of an unanswered question from 2017: How can I intercept some HTTP request fallback to custom file?