diff --git a/packages/cli/config/index.ts b/packages/cli/config/index.ts index b6810bf9f6591..1e5b25f93306d 100644 --- a/packages/cli/config/index.ts +++ b/packages/cli/config/index.ts @@ -415,7 +415,7 @@ const config = convict({ format: String, default: '', env: 'N8N_EDITOR_BASE_URL', - doc: 'Public URL where the editor is accessible; path will be concatenated to this base. Also used for emails sent from n8n.', + doc: 'Public URL where the editor is accessible. Also used for emails sent from n8n.', }, security: { diff --git a/packages/cli/src/UserManagement/UserManagementHelper.ts b/packages/cli/src/UserManagement/UserManagementHelper.ts index e46278f63dd05..332a0efb7713d 100644 --- a/packages/cli/src/UserManagement/UserManagementHelper.ts +++ b/packages/cli/src/UserManagement/UserManagementHelper.ts @@ -10,6 +10,7 @@ import { MAX_PASSWORD_LENGTH, MIN_PASSWORD_LENGTH, User } from '../databases/ent import { Role } from '../databases/entities/Role'; import { AuthenticatedRequest } from '../requests'; import config = require('../../config'); +import { getWebhookBaseUrl } from '../WebhookHelpers'; export async function getWorkflowOwner(workflowId: string | number): Promise { const sharedWorkflow = await Db.collections.SharedWorkflow!.findOneOrFail({ @@ -55,9 +56,9 @@ export async function getInstanceOwner(): Promise { * Return the n8n instance base URL without trailing slash. */ export function getInstanceBaseUrl(): string { - const editorBaseUrl = config.get('editorBaseUrl'); - const baseUrl = editorBaseUrl ? editorBaseUrl + config.get('path') : GenericHelpers.getBaseUrl(); - return baseUrl.endsWith('/') ? baseUrl.slice(0, baseUrl.length - 1) : baseUrl; + const n8nBaseUrl = config.get('editorBaseUrl') || getWebhookBaseUrl(); + + return n8nBaseUrl.endsWith('/') ? n8nBaseUrl.slice(0, n8nBaseUrl.length - 1) : n8nBaseUrl; } export async function isInstanceOwnerSetup(): Promise {