Skip to content

Commit

Permalink
fix: handle response status 0 in service worker
Browse files Browse the repository at this point in the history
  • Loading branch information
Sheraff committed Oct 4, 2024
1 parent ff3b539 commit 46d0dd0
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions public/sw.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ s.addEventListener("fetch", (event) => {
event.respondWith(
fetch(event.request)
.then((response) => {
if (response.status === 0) {
return response
}
const newHeaders = new Headers(response.headers)
newHeaders.set("Cross-Origin-Opener-Policy", "same-origin")
newHeaders.set("Cross-Origin-Embedder-Policy", "require-corp")
Expand Down

0 comments on commit 46d0dd0

Please sign in to comment.