-
-
Notifications
You must be signed in to change notification settings - Fork 293
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
Make networkFirstResponse
answer behaviour configurable
#327
base: master
Are you sure you want to change the base?
Conversation
@BowlingX There should be tests for each feature added. Also, can you write an usage example so we all could clearly understand how the feature will be used? An real world example would be great :-) |
…dServeFromNetwork
Real world usecase: Imagine having the following configuration: const config = {
/*...*/
externals: ['/de-de', '/en-en'],
cacheMaps: [{
match: function match(requestUrl) {
const localeMatch = requestUrl.pathname.match(/(\/[a-z]{2}-[a-z]{2})(.*)/);
if (localeMatch && localeMatch[1]) {
return new URL(localeMatch[1], location);
}
},
requestTypes: ['navigate']
}]
/*...*/
} The configuration defines 2 external sites (based on the locale) as appshell. It will serve any request that matches the pattern with the locale and falls back to /de-de or /en-en respectively. (e.g. /de-de/some/path -> /de-de if offline etc.) Right now the uncached response will only be forwarded if the server's response is in the In my case, the Page is rendered on the server as well and prepopulated with data and/or might even be redirected. When the user visits the page for the first time this will work, but in case he already downloaded the assets, the page will not redirect or error / not found. It will show the cached version of /de-de for example. |
@NekR is there more information necessary? |
I don't really have time to handle this week, sorry. I think provided info
is enough and use cases are good. I'll review the code/api next week and
merge if everything is good. Thanks for making this PR!
…On Dec 15, 2017 2:50 PM, "David Heidrich" ***@***.***> wrote:
@NekR <https://github.com/nekr> is there more information necessary?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#327 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABIlkfDcac4Bec9NquL6kCZ4-8waTmsSks5tAl0SgaJpZM4Q5i23>
.
|
Any progress on this? @NekR |
# Conflicts: # docs/options.md # lib/misc/sw-template.js # lib/service-worker.js # package.json # src/service-worker.js # tests/legacy/fixtures/basic-wIth-sw-out/__expected/sw.js # tests/legacy/fixtures/basic-with-sw-custom-entry/__expected/sw.js # tests/legacy/fixtures/cachemaps-basic/__expected/sw.js # tests/legacy/fixtures/loaders-externals/__expected/sw.js # tests/legacy/fixtures/sw-minify-false/__expected/sw.js # tests/legacy/fixtures/sw-minify-true/__expected/sw.js
Update from base repository
@NekR we fixed the failing tests due to updates in the meantime. Is there anything else we can provide? |
…on issues, adjusted tests
This pull requests addresses the issue described in #324.