Closed frederikhors closed 4 weeks ago
I have this workbox service worker setup:
importScripts('https://storage.googleapis.com/workbox-cdn/releases/7.1.0/workbox-sw.js'); workbox.routing.registerRoute( ({ url }) => !url.pathname.includes("."), new workbox.strategies.StaleWhileRevalidate(), ); self.skipWaiting(); workbox.core.clientsClaim();
and it is working very good!
Now I have a page with a form to add a new todo: /todos/new with a simple <form method="post"> in it.
/todos/new
<form method="post">
After the POST request the server returns a redirect 303 - /todods.
303 - /todods
In the browser (Chrome) I can clearly see the POST /todos/new request with the redirect response and a new request GET /todos.
POST /todos/new
GET /todos
The issue is that the GET /todos is not handled by Workbox.
I expect it to serve the cached version of /todos (is already in cache of course).
/todos
For example, for the others GET requests (/todos included) I get in the browser console messages from Workbox like this:
workbox Router is responding to: / workbox Router is responding to: /todos
but for the GET /todos after the POST /todos/new workbox is not stepping in.
Why?
It was an XHR issue.
I have this workbox service worker setup:
and it is working very good!
Now I have a page with a form to add a new todo:
/todos/new
with a simple<form method="post">
in it.After the POST request the server returns a redirect
303 - /todods
.In the browser (Chrome) I can clearly see the
POST /todos/new
request with the redirect response and a new requestGET /todos
.The issue is that the
GET /todos
is not handled by Workbox.I expect it to serve the cached version of
/todos
(is already in cache of course).For example, for the others GET requests (
/todos
included) I get in the browser console messages from Workbox like this:but for the
GET /todos
after thePOST /todos/new
workbox is not stepping in.Why?