Closed myNameIsDu closed 1 year ago
We're facing the same issue here when upgrading to v9, are we doing something wrong? Did you manage to fix this?
We're facing the same issue here when upgrading to v9, are we doing something wrong? Did you manage to fix this?
I can only add globalPrefix in the exclude
export class AppModule implements NestModule {
configure(consumer: MiddlewareConsumer) {
consumer
.apply(AuthMiddleware)
.exclude(
{
path: `${globalPrefix}/public/xxxxxx`,
method: RequestMethod.GET,
},
)
.forRoutes('/*');
consumer.apply(xxxMiddleware).forRoutes('/xxxxx/*');
}
}
Let's track this here https://github.com/nestjs/nest/pull/11042
Is there an existing issue for this?
Current behavior
when use
setGlobalPrefix
theMiddleware
'sexclude
andforRoutes
behavior inconsistently.Minimum reproduction code
https://stackblitz.com/edit/nestjs-typescript-starter-pzhkvx?file=src/app.module.ts
Steps to reproduce
/api/hello
./api/hello
. Get rid of/hello
's comment.npm start
./api/hello
.forRoutes('/admin/*')
comment . Get rid of/api/hello
's comment.npm start
./api/hello
.Expected behavior
exclude
andforRoutes
have the same behaviorPackage
Other package
No response
NestJS version
9.0.5
Packages versions
Node.js version
v16.14.2
In which operating systems have you tested?
Other
No response