diff --git a/pkg/epinio/store/epinio-store/actions.ts b/pkg/epinio/store/epinio-store/actions.ts index 3c307609e1..a56c4441c7 100644 --- a/pkg/epinio/store/epinio-store/actions.ts +++ b/pkg/epinio/store/epinio-store/actions.ts @@ -59,11 +59,15 @@ export default { return await ps .then((prependPath = opt?.prependPath) => { if (isSingleProduct) { - const url = parseUrl(opt.url); + if (opt.url.startsWith('/')) { + opt.url = prependPath + opt.url; + } else { + const url = parseUrl(opt.url); - if (!url.path.startsWith(prependPath)) { - url.path = prependPath + url.path; - opt.url = unParseUrl(url); + if (!url.path.startsWith(prependPath)) { + url.path = prependPath + url.path; + opt.url = unParseUrl(url); + } } } else { const currentClusterId = clusterId || rootGetters['clusterId']; diff --git a/shell/nuxt.config.js b/shell/nuxt.config.js index 60eff53147..0520f6fe7f 100644 --- a/shell/nuxt.config.js +++ b/shell/nuxt.config.js @@ -244,8 +244,9 @@ export default function(dir, _appConfig) { if ( pl !== STANDARD ) { console.log(`PL: ${ pl }`); // eslint-disable-line no-console } + const rancherEnv = process.env.RANCHER_ENV || 'web'; - console.log(`API: ${ api }`); // eslint-disable-line no-console + console.log(`API: '${ api }'. Env: '${ rancherEnv }'`); // eslint-disable-line no-console const config = { dev, @@ -257,9 +258,10 @@ export default function(dir, _appConfig) { dev, pl, perfTest, + rancherEnv }, - publicRuntimeConfig: { rancherEnv: process.env.RANCHER_ENV || 'web' }, + publicRuntimeConfig: { rancherEnv }, buildDir: dev ? '.nuxt' : '.nuxt-prod', @@ -562,6 +564,7 @@ export default function(dir, _appConfig) { // Proxy: https://github.com/nuxt-community/proxy-module#options proxy: { '/k8s': proxyWsOpts(api), // Straight to a remote cluster (/k8s/clusters//) + '/pp': proxyWsOpts(api), // For (epinio) standalone API '/api': proxyWsOpts(api), // Management k8s API '/apis': proxyWsOpts(api), // Management k8s API '/v1': proxyWsOpts(api), // Management Steve API diff --git a/shell/plugins/steve/actions.js b/shell/plugins/steve/actions.js index 3ce55d662f..d4236700c3 100644 --- a/shell/plugins/steve/actions.js +++ b/shell/plugins/steve/actions.js @@ -20,14 +20,18 @@ export default { // FIXME: RC Standalone - Tech Debt move this to steve store get/set prependPath // Cover cases where the steve store isn't actually going out to steve (epinio standalone) - const prependPath = process.env.rancherEnv === 'epinio' ? `/pp/v1/epinio/rancher` : ''; + const prependPath = this.$config.rancherEnv === 'epinio' ? `/pp/v1/epinio/rancher` : ''; if (prependPath) { - const url = parseUrl(opt.url); + if (opt.url.startsWith('/')) { + opt.url = prependPath + opt.url; + } else { + const url = parseUrl(opt.url); - if (!url.path.startsWith(prependPath)) { - url.path = prependPath + url.path; - opt.url = unParseUrl(url); + if (!url.path.startsWith(prependPath)) { + url.path = prependPath + url.path; + opt.url = unParseUrl(url); + } } }