diff --git a/packages/cli/src/Server.ts b/packages/cli/src/Server.ts index ee248e4d14..09ef7e18a6 100644 --- a/packages/cli/src/Server.ts +++ b/packages/cli/src/Server.ts @@ -1711,9 +1711,11 @@ class App { // Read the index file and replace the path placeholder const editorUiPath = require.resolve('n8n-editor-ui'); const filePath = pathJoin(pathDirname(editorUiPath), 'dist', 'index.html'); - let readIndexFile = readFileSync(filePath, 'utf8'); const n8nPath = config.get('path'); + + let readIndexFile = readFileSync(filePath, 'utf8'); readIndexFile = readIndexFile.replace(/\/%BASE_PATH%\//g, n8nPath); + readIndexFile = readIndexFile.replace(/\/favicon.ico/g, `${n8nPath}/favicon.ico`); // Serve the altered index.html file separately this.app.get(`/index.html`, async (req: express.Request, res: express.Response) => { diff --git a/packages/editor-ui/package.json b/packages/editor-ui/package.json index 552fe79330..8a6dfcfb38 100644 --- a/packages/editor-ui/package.json +++ b/packages/editor-ui/package.json @@ -14,7 +14,7 @@ "url": "git+https://github.com/n8n-io/n8n.git" }, "scripts": { - "build": "vue-cli-service build", + "build": "cross-env VUE_APP_PUBLIC_PATH=\"/%BASE_PATH%/\" vue-cli-service build", "dev": "npm run serve", "lint": "vue-cli-service lint", "serve": "cross-env VUE_APP_URL_BASE_API=http://localhost:5678/ vue-cli-service serve", diff --git a/packages/editor-ui/public/index.html b/packages/editor-ui/public/index.html index 9193fda976..b533aea170 100644 --- a/packages/editor-ui/public/index.html +++ b/packages/editor-ui/public/index.html @@ -4,13 +4,13 @@ - + n8n.io - Workflow Automation
diff --git a/packages/editor-ui/src/components/MainSidebar.vue b/packages/editor-ui/src/components/MainSidebar.vue index a9cf787ef4..baea830b01 100644 --- a/packages/editor-ui/src/components/MainSidebar.vue +++ b/packages/editor-ui/src/components/MainSidebar.vue @@ -209,7 +209,7 @@ export default mixins( return { aboutDialogVisible: false, // @ts-ignore - basePath: window.BASE_PATH, + basePath: this.$store.getters.getBaseUrl, isCollapsed: true, credentialNewDialogVisible: false, credentialOpenDialogVisible: false, diff --git a/packages/editor-ui/src/router.ts b/packages/editor-ui/src/router.ts index 4754098c97..348a1ea66b 100644 --- a/packages/editor-ui/src/router.ts +++ b/packages/editor-ui/src/router.ts @@ -9,7 +9,7 @@ Vue.use(Router); export default new Router({ mode: 'history', // @ts-ignore - base: window.BASE_PATH, + base: window.BASE_PATH === '/%BASE_PATH%/' ? '/' : window.BASE_PATH, routes: [ { path: '/execution/:id', diff --git a/packages/editor-ui/src/store.ts b/packages/editor-ui/src/store.ts index 0e1e5f14c4..e0ba93b7cf 100644 --- a/packages/editor-ui/src/store.ts +++ b/packages/editor-ui/src/store.ts @@ -39,7 +39,7 @@ export const store = new Vuex.Store({ activeActions: [] as string[], activeNode: null as string | null, // @ts-ignore - baseUrl: window.BASE_PATH ? window.BASE_PATH : '/', + baseUrl: process.env.VUE_APP_URL_BASE_API ? process.env.VUE_APP_URL_BASE_API : (window.BASE_PATH === '/%BASE_PATH%/' ? '/' : window.BASE_PATH), credentials: null as ICredentialsResponse[] | null, credentialTypes: null as ICredentialType[] | null, endpointWebhook: 'webhook', diff --git a/packages/editor-ui/vue.config.js b/packages/editor-ui/vue.config.js index c5ffc5fed8..cdcd8259f9 100644 --- a/packages/editor-ui/vue.config.js +++ b/packages/editor-ui/vue.config.js @@ -29,5 +29,5 @@ module.exports = { }, }, }, - publicPath: process.env.VUE_APP_PUBLIC_PATH ? process.env.VUE_APP_PUBLIC_PATH : '/%BASE_PATH%/', + publicPath: process.env.VUE_APP_PUBLIC_PATH ? process.env.VUE_APP_PUBLIC_PATH : '/', };