Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

consumer.apply(JwtMiddleware).forRoutes(AppController) with setGlobalPrefix dont work #718

igorivaniuk opened this issue May 21, 2018 · 2 comments


Copy link

commented May 21, 2018

I'm submitting a...

[x] Regression 
[ ] Bug report
[ ] Feature request
[ ] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead post your question on Stack Overflow.

Current behavior

when set app.setGlobalPrefix('api')

  imports: [],
  controllers: [AppController],
  providers: [ AppService ]
export class AppModule {
  configure(consumer: MiddlewareConsumer) {
    consumer.apply(JwtMiddleware).forRoutes(AppController); // not work
    consumer.apply(FooMiddleware).forRoutes('/home'); // not work
    consumer.apply(BarMiddleware).forRoutes('/api/home'); // work


export class AppController {
  constructor() {}
  root(@Req() req: any): any {
    return {
      jwt: req.jwt,

Expected behavior

consumer.apply(JwtMiddleware).forRoutes(AppController); // work
consumer.apply(FooMiddleware).forRoutes('/home'); // work
consumer.apply(BarMiddleware).forRoutes('/api/home'); // work

Minimal reproduction of the problem with instructions

What is the motivation / use case for changing the behavior?


Nest version: v8.9.4

Nest: 5.0.0 

For Tooling issues:
- Node version: XX  
- Platform:  



This comment has been minimized.

Copy link

commented May 23, 2018

Thanks for reporting!

@kamilmysliwiec kamilmysliwiec added this to the 5.0.1 milestone May 23, 2018

@kamilmysliwiec kamilmysliwiec self-assigned this May 23, 2018


This comment has been minimized.

Copy link

commented May 25, 2018

Fixed in v5.0.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
2 participants
You can’t perform that action at this time.