Skip to content

[Question] Service Worker configuration with Express #2412

Description

@chemitaxis

Hi, I would like to know what is the best approach to disable the cache for some files in CRA.

I have configured my CRA with express like this:

// Always return the main index.html, so react-router
// render the route in the client
app.get('*', ensureAuthenticated, (req, res) => {
  res.sendFile(path.resolve(__dirname, 'index.html'));
});

My problem is that sw, is caching the response, and the ensureAuthenticated middleware is not triggering. How can I disable service-worker for this file?

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions