From 85888bc420a03338920bb4672c1b0f03c54ebc74 Mon Sep 17 00:00:00 2001 From: cool Date: Wed, 22 Nov 2023 11:18:58 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=9D=83=E9=99=90=E6=A0=A1?= =?UTF-8?q?=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/user/middleware/app.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/modules/user/middleware/app.ts b/src/modules/user/middleware/app.ts index e379b3e..a3882a6 100644 --- a/src/modules/user/middleware/app.ts +++ b/src/modules/user/middleware/app.ts @@ -21,6 +21,9 @@ export class UserMiddleware implements IMiddleware { ignoreUrls: string[] = []; + @Config('koa.globalPrefix') + prefix; + @Init() async init() { this.ignoreUrls = this.coolUrlTagData.byKey(TagTypes.IGNORE_TOKEN, 'app'); @@ -29,7 +32,7 @@ export class UserMiddleware implements IMiddleware { resolve() { return async (ctx: Context, next: NextFunction) => { let { url } = ctx; - url = url.split('?')[0]; + url = url.replace(this.prefix, '').split('?')[0]; if (_.startsWith(url, '/app/')) { const token = ctx.get('Authorization'); try {