New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

workbox.routing.RequestDestinationRoute? #1606

Closed
jeffposnick opened this Issue Aug 17, 2018 · 2 comments

Comments

Projects
None yet
2 participants
@jeffposnick
Collaborator

jeffposnick commented Aug 17, 2018

This was suggested by @tomayac.

Using request.destination as a criteria for routing to a specific response strategy offers some advantages over URL-based matching, since your routing logic would not have to change as much due to changes in your URL structure.

A new RequestDestinationRoute class in workbox-routing could simplify creating routes that use that info. (The alternative is asking folks to write a custom matchCallback.)

One wrinkle is that applying a different strategy based on whether a request is same- or cross-origin is frequently important, and you lose that nuance if you just check for request.destination. So perhaps there would need to be some configuration when constructing RequestDestinationRoute that allowed you to opt-in to cross-origin matching.

@tomayac

This comment has been minimized.

tomayac commented Aug 20, 2018

Thanks for opening this issue, @jeffposnick! Some more background on this feature request can be found in this article. People can play with the property and see it in action in the Request.destination playground app.

@jeffposnick

This comment has been minimized.

Collaborator

jeffposnick commented Sep 25, 2018

After chatting with @tomayac, I think the approach we're going to go with is to update https://developers.google.com/web/tools/workbox/guides/common-recipes#cache_css_and_javascript_files to include a recipe that uses a custom matchCallback that feature-detects request.destination, and uses it if the current browser supports it (falling back to checking the url.pathname if not).

tomayac added a commit to tomayac/WebFundamentals that referenced this issue Nov 7, 2018

petele added a commit to google/WebFundamentals that referenced this issue Nov 9, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment