WIP: use cors proxy for outbound requests (#2533)

This commit is contained in:
Neal Shah
2026-02-24 01:10:23 -05:00
committed by GitHub
parent eaaeb4e6a4
commit c14dd5ae78
2 changed files with 15 additions and 2 deletions
+7 -2
View File
@@ -184,8 +184,10 @@ class Kernel extends AdvancedBase {
throw e;
}
await svc_systemValidation.mark_invalid('failed to initialize services',
e);
await svc_systemValidation.mark_invalid(
'failed to initialize services',
e,
);
}
for ( const module of this.modules ) {
@@ -244,6 +246,9 @@ class Kernel extends AdvancedBase {
global_config: require('./config'),
};
// Also expose global_config globally
globalThis.global_config = require('./config');
// Install the mods...
const mod_install_root_context = Context.get();
+8
View File
@@ -192,6 +192,14 @@ async function secureAxiosRequest (axios, url, options = {}) {
};
try {
if ( globalThis.global_config.services.secureCorsProxy.url ) {
url = globalThis.global_config.services.secureCorsProxy.url + url;
if ( ! secureOptions.headers ) {
secureOptions.headers = {};
}
secureOptions.headers['x-cors-proxy-auth-secret'] = globalThis.global_config.services.secureCorsProxy.secret;
}
const response = await axios.get(url, secureOptions);
// Check if the response is a redirect (maxRedirects: 0 means axios returns but doesn't follow)