Skip to content
Snippets Groups Projects
Commit eae78fbe authored by Timothee P's avatar Timothee P :sunflower:
Browse files

add mapcache route and all osm tile & allow filter out 204 status for api cache

parent 0b44192f
No related branches found
No related tags found
2 merge requests!424version 3.1.0,!312REDMINE_ISSUE-13321
...@@ -29,10 +29,15 @@ if (workbox) { ...@@ -29,10 +29,15 @@ if (workbox) {
new RegExp('.*/api/.*'), new RegExp('.*/api/.*'),
new workbox.strategies.NetworkFirst({ new workbox.strategies.NetworkFirst({
cacheName: 'api', cacheName: 'api',
plugins: [
new workbox.cacheableResponse.Plugin({
statuses: [0, 200],
}),
],
}) })
); );
workbox.routing.registerRoute( workbox.routing.registerRoute(
/^https:\/\/c\.tile\.openstreetmap\.fr/, /^https:\/\/[a-zA-Z]\.tile\.openstreetmap\.fr/,
new workbox.strategies.CacheFirst({ new workbox.strategies.CacheFirst({
cacheName: 'osm', cacheName: 'osm',
plugins: [ plugins: [
...@@ -46,6 +51,21 @@ if (workbox) { ...@@ -46,6 +51,21 @@ if (workbox) {
], ],
}) })
); );
workbox.routing.registerRoute(
/^https:\/\/osm\.geo2france\.fr\/mapcache/,
new workbox.strategies.CacheFirst({
cacheName: 'mapcache',
plugins: [
new workbox.cacheableResponse.Plugin({
statuses: [0, 200],
}),
new workbox.expiration.Plugin({
maxAgeSeconds: 60 * 60 * 24 * 365,
// maxEntries: 30, pour limiter le nombre d'entrée dans le cache
}),
],
})
);
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment