Skip to content

Commit

Permalink
feat: HomeAssistant support: URL intercept tweak (#219)
Browse files Browse the repository at this point in the history
  • Loading branch information
rentallect authored Aug 21, 2024
1 parent 21cfaf6 commit 75fbf20
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/ZitiFirstStrategy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -793,9 +793,13 @@ class ZitiFirstStrategy extends CacheFirst /* NetworkFirst */ {
const urlSearchParams = new URLSearchParams(url.search);
const codeParm = urlSearchParams.get('code');
const stateParm = urlSearchParams.get('state');
if (codeParm && stateParm) {
tryZiti = false;
}
if (codeParm && stateParm) { // possible IdP-related URL
if (requestURL.hostname === this._zitiBrowzerServiceWorkerGlobalScope._zitiConfig.browzer.bootstrapper.self.host) { // ..but if hitting the protected web app itself
tryZiti = true; // ..then let it go over Ziti
} else {
tryZiti = false; // ..otherwise, route over raw internet since it's IdP-related
}
}
}

/**
Expand Down

0 comments on commit 75fbf20

Please sign in to comment.