Coder Social home page Coder Social logo

Mapping remote endpoints about dsw HOT 1 OPEN

sinclairzx81 avatar sinclairzx81 commented on May 27, 2024
Mapping remote endpoints

from dsw.

Comments (1)

felipenmoura avatar felipenmoura commented on May 27, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.