Skip to content

Commit

Permalink
fix: non-default bootstrapper port handling (#195)
Browse files Browse the repository at this point in the history
  • Loading branch information
rentallect authored Mar 15, 2024
1 parent d49614c commit 7133377
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/ZitiFirstStrategy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -550,7 +550,7 @@ class ZitiFirstStrategy extends CacheFirst /* NetworkFirst */ {
var browzerLoadBalancerRegex = new RegExp( this._zitiBrowzerServiceWorkerGlobalScope._zitiConfig.browzer.loadbalancer.host , 'g' );

if (
(isEqual(targetHost, this._zitiBrowzerServiceWorkerGlobalScope._zitiConfig.browzer.bootstrapper.self.host) && (isEqual(targetPort, `443`))) // yes, the request is targeting the Ziti BrowZer Bootstrapper
(isEqual(targetHost, this._zitiBrowzerServiceWorkerGlobalScope._zitiConfig.browzer.bootstrapper.self.host) && (isEqual(targetPort, this._zitiBrowzerServiceWorkerGlobalScope._zitiConfig.browzer.bootstrapper.self.port))) // yes, the request is targeting the Ziti BrowZer Bootstrapper
|| (this._zitiBrowzerServiceWorkerGlobalScope._zitiConfig.browzer.loadbalancer.host && request.url.match( browzerLoadBalancerRegex )) ) { // yes, the request is targeting the Ziti BrowZer LoadBalancer

var newUrl = new URL( request.url );
Expand All @@ -572,6 +572,10 @@ class ZitiFirstStrategy extends CacheFirst /* NetworkFirst */ {
newUrl.hostname = this._zitiBrowzerServiceWorkerGlobalScope._zitiConfig.browzer.bootstrapper.target.service;
newUrl.port = this._zitiBrowzerServiceWorkerGlobalScope._zitiConfig.browzer.bootstrapper.target.port;

if (isEqual(newUrl.port, this._zitiBrowzerServiceWorkerGlobalScope._zitiConfig.browzer.bootstrapper.self.port)) {
newUrl.port = '';
}

var pathnameArray = newUrl.pathname.split('/');
var targetpathnameArray = this._zitiBrowzerServiceWorkerGlobalScope._zitiConfig.browzer.bootstrapper.target.path.split('/');

Expand Down

0 comments on commit 7133377

Please sign in to comment.