Skip to content

Commit 4bb4446

Browse files
committed
🐛 Prevent service worker from intercepting cross-origin requests
1 parent e64cf8e commit 4bb4446

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

public/sw.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -572,6 +572,14 @@ self.addEventListener('fetch', (event) => {
572572
return
573573
}
574574

575+
// Don't intercept cross-origin requests that aren't LLM or HuggingFace APIs
576+
// (those are handled above). This prevents the SW from modifying external
577+
// API calls like OAuth token exchanges (e.g. Vertex AI service account auth).
578+
const isSameOrigin = url.origin === self.location.origin
579+
if (!isSameOrigin) {
580+
return
581+
}
582+
575583
// Skip caching for model registry - always fetch fresh
576584
if (url.pathname === '/models/model-registry.json') {
577585
return

0 commit comments

Comments
 (0)