Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bootstrapper config rename #177

Merged
merged 1 commit into from
Jul 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading