Skip to content
This repository has been archived by the owner on Dec 20, 2018. It is now read-only.

How to prevent service worker caching a route #762

Closed
chris-herring opened this issue Oct 4, 2018 · 3 comments
Closed

How to prevent service worker caching a route #762

chris-herring opened this issue Oct 4, 2018 · 3 comments
Labels

Comments

@chris-herring
Copy link

I'm using the React Redux template and API calls within the app work fine and are not being cached by the service worker. However I have a route to download a file that I need to use window.open() to trigger and the service worker causes it to return the 404 react router route I have defined. I've tried hitting it via both a MVC route and a Web API route and both result in the same issue.

How can I work around this issue without disabling the service worker entirely?

@mkArtakMSFT
Copy link
Member

Thanks for contacting us, @chris-herring.
@SteveSandersonMS, any suggestions? Thanks!

@SteveSandersonMS
Copy link
Member

This sounds like a question about how to configure Create-React-App's built-in service worker. For information about that, please see Create-React-App (CRA) docs. Note that as far as I know, currently CRA deliberately doesn't make this very configurable, so you might need to raise questions with the CRA community if you're having trouble. Finally, if CRA's built-in service worker doesn't meet your needs and they don't have sufficient configurability, then disabling it and implementing your own service worker manually is likely to be the only reasonable option.

@mkArtakMSFT
Copy link
Member

Thanks for contacting us. We believe that the question you've raised have been answered. If you still feel a need to continue the discussion, feel free to reopen it and add your comments.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants