Skip to content

Commit

Permalink
feat: bootstrapper config rename (#177)
Browse files Browse the repository at this point in the history
  • Loading branch information
rentallect authored Jul 26, 2023
1 parent eeeb8c6 commit e918f62
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 35 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@
"@auth0/auth0-spa-js": "^2.0.4",
"@azure/msal-browser": "^2.38.0",
"@babel/runtime": "^7.17.9",
"@openziti/ziti-browzer-core": "^0.26.0",
"@openziti/ziti-browzer-core": "^0.27.0",
"bowser": "^2.11.0",
"cookie-interceptor": "^1.0.0",
"core-js": "^3.22.8",
Expand Down
32 changes: 2 additions & 30 deletions src/runtime.js
Original file line number Diff line number Diff line change
Expand Up @@ -2209,37 +2209,9 @@ const zitiFetch = async ( url, opts ) => {

if (isUndefined(serviceName)) { // If we have no serviceConfig associated with the hostname:port

let routeOverCORSProxy = zitiBrowzerRuntime.zitiContext.shouldRouteOverCORSProxy( url );

if (routeOverCORSProxy) { // If hostname:port is something we need to CORS Proxy

zitiBrowzerRuntime.logger.warn('zitiFetch(): doing CORS Proxying of [%s]', url);

let corsTargetHostname = newUrl.hostname;
let corsTargetPort = newUrl.port;
if (corsTargetPort === '') {
if (newUrl.protocol === 'https:') {
corsTargetPort = '443';
} else {
corsTargetPort = '80';
}
}

let corsTargetPathname = newUrl.pathname;
newUrl.hostname = window.zitiBrowzerRuntime.zitiConfig.browzer.bootstrapper.self.host;
newUrl.port = 443;
newUrl.pathname = '/ziti-cors-proxy/' + corsTargetHostname + ':' + corsTargetPort + corsTargetPathname;
zitiBrowzerRuntime.logger.warn( 'zitiFetch: transformed URL: ', newUrl.toString());

return window._ziti_realFetch(newUrl, opts); // Send special request to HTTP Agent

} else {

zitiBrowzerRuntime.logger.warn('zitiFetch(): no associated serviceConfig, bypassing intercept of [%s]', url);
return window._ziti_realFetch(url, opts);
zitiBrowzerRuntime.logger.warn('zitiFetch(): no associated serviceConfig, bypassing intercept of [%s]', url);
return window._ziti_realFetch(url, opts);

}

}
}

Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1195,10 +1195,10 @@
"@types/emscripten" "^1.39.6"
"@wasmer/wasi" "^1.0.2"

"@openziti/ziti-browzer-core@^0.26.0":
version "0.26.0"
resolved "https://registry.yarnpkg.com/@openziti/ziti-browzer-core/-/ziti-browzer-core-0.26.0.tgz#0d53acf2d1f312f68cc7047d1bc467c68e935d0d"
integrity sha512-T/aeKT/SoLNoWoG7UBDlUd/h2aqqvYDdYPB0xFEvkFo+oicair6IZwZEL19wY7spKyjMWAklY59vTcMiSOoMbw==
"@openziti/ziti-browzer-core@^0.27.0":
version "0.27.0"
resolved "https://registry.yarnpkg.com/@openziti/ziti-browzer-core/-/ziti-browzer-core-0.27.0.tgz#413e6de182f91a183346dcfb707f2de744ae6f07"
integrity sha512-hV+D+0KjrPEXZonaGjctlpfz65m7H8xpV8yuzfWqVrRJ4CRoXF+QLMeOuJdP5OlCyn3vUhvt7NTEAND92K6Rdw==
dependencies:
"@openziti/libcrypto-js" "^0.15.0"
"@openziti/ziti-browzer-edge-client" "^0.6.2"
Expand Down

0 comments on commit e918f62

Please sign in to comment.