N
N
nioterzor2018-04-20 16:22:29
JavaScript
nioterzor, 2018-04-20 16:22:29

Path ignore in sw-precache-config doesn't work?

module.exports = {
  staticFileGlobs: [
    'index.html',
    'manifest.json',
    'bower_components/webcomponentsjs/*',
  ],
  navigateFallback: 'index.html',
  runtimeCaching: [{
    urlPattern: /.+\/api\/.+/,
    handler: 'networkOnly',
  }],
};

Bottom line: there is a SPA application with a service-worker for resource cache. When opening /api/route without browser cache - everything is ok. When opening /api/route after visiting the main page (and any other available to the user), /api/route issues a stub of the main page without data (general layout). When deleting in Developer Tools => Cache Storage => right click => delete, again gives the correct answer.
Maybe I misunderstand the essence of the option or the essence of the work of the service-worker?
The user goes to /api/route from the email.
So far, as a solution, I see only the allocation of a separate subdomain for the entire / api.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question