From d55412845784fda4d42a1dcaca60515ad10d2aa0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E0=A4=95=E0=A4=BE=E0=A4=B0=E0=A4=A4=E0=A5=8B=E0=A4=AB?= =?UTF-8?q?=E0=A5=8D=E0=A4=AB=E0=A5=87=E0=A4=B2=E0=A4=B8=E0=A5=8D=E0=A4=95?= =?UTF-8?q?=E0=A5=8D=E0=A4=B0=E0=A4=BF=E0=A4=AA=E0=A5=8D=E0=A4=9F=E2=84=A2?= Date: Mon, 5 Sep 2022 20:39:48 +0200 Subject: [PATCH] fix(cli): include "auth-excluded" endpoints on the history middleware as well (#4028) right now endpoints defined in `N8N_AUTH_EXCLUDE_ENDPOINTS` are skipping the JWT auth, and the history middleware is returning 404 on these urls. This change ensures that these endpoints skip all auth-related middlewares. --- packages/cli/src/Server.ts | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/packages/cli/src/Server.ts b/packages/cli/src/Server.ts index b0cd3c6f3ed..7396cf1517e 100644 --- a/packages/cli/src/Server.ts +++ b/packages/cli/src/Server.ts @@ -665,8 +665,16 @@ class App { rewrites: [ { from: new RegExp( - // eslint-disable-next-line no-useless-escape - `^\/(${this.restEndpoint}|healthz|metrics|css|js|${this.endpointWebhook}|${this.endpointWebhookTest})\/?.*$`, + `^/(${[ + 'healthz', + 'metrics', + 'css', + 'js', + this.restEndpoint, + this.endpointWebhook, + this.endpointWebhookTest, + ...excludeEndpoints.split(':'), + ].join('|')})/?.*$`, ), to: (context) => { return context.parsedUrl.pathname!.toString();