Comments (1)
Cool @sinclairzx81
We tried to address this with some different approaches.
If I'm not mistaken you can have a generic rule (in the end, to be used if no other rule has applied).
If that one uses cache (to automatically cache any request), it will try and cache requests from other domains too.
The downside is that, due to permissions and policies, this is an "opaque answer". That means we can store it in cache and use it, but we cannot check for its contents.
This means that, if the first time it failed, we have no way to know about it, and will store the failure in cache :/
Perhaps this can be fixed with some server side header policy allowing such requests.
I think we need to run some tests to ensure this exact situation works, but you can try this, so far:
"videos": { // the rule
"match": { "path": "/bucket/(.*)" }, // match any file in that directory
"strategy": "offline-first",
"apply": {
"redirect": "https://remote/bucket/video/$1" // will redirect to the CDN
"cache": { // and will also cache it
"name": "cached-videos",
"version": "1"
}
}
}
Perhaps, an interesting thing to add too is a flag like large: true
and then, for large files to be stored in cache, we could use the filesystem api instead of the cacheapi itself.
from dsw.
Related Issues (20)
- Critical dependency HOT 3
- Make text in commented JSON example unselectable
- Fix invalid commented JSON example
- Fix missing indexeddb-manager.js module
- Incorrect package.json main reference
- Add timeout for network requests HOT 14
- Add example with cache expiration headers HOT 1
- Browser support
- Docs isn't clear enough on how to run dsw HOT 1
- Missing npm install on Contributing section
- boilerplate directory isn't working HOT 2
- Add support for tracing request HOT 2
- Look for updates when building HOT 1
- Readme file typo
- Uncaught (in promise) TypeError: Cannot read property 'transaction' of undefined HOT 1
- Add API for web notification in the client scope
- Add a Graphic Interface for debugging requests HOT 2
- Add support for WebSockets
- Bundle Cache HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dsw.