mirror of
https://github.com/Memo-2023/mana-monorepo.git
synced 2026-05-14 21:41:09 +02:00
fix(auth): use object syntax for global prefix excludes
Use { path, method } syntax for NestJS global prefix excludes to ensure
OIDC routes (.well-known/*, api/oidc/*) are properly excluded from the
/api/v1 prefix.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
00d28bc522
commit
9a7afea7fe
1 changed files with 8 additions and 2 deletions
|
|
@ -1,5 +1,5 @@
|
|||
import { NestFactory } from '@nestjs/core';
|
||||
import { ValidationPipe } from '@nestjs/common';
|
||||
import { ValidationPipe, RequestMethod } from '@nestjs/common';
|
||||
import { ConfigService } from '@nestjs/config';
|
||||
import { Request, Response, NextFunction } from 'express';
|
||||
import helmet from 'helmet';
|
||||
|
|
@ -83,7 +83,13 @@ async function bootstrap() {
|
|||
// Better Auth generates verification URLs with /api/auth/* prefix
|
||||
// OIDC Provider requires routes without prefix: /.well-known/*, /api/oidc/*
|
||||
app.setGlobalPrefix('api/v1', {
|
||||
exclude: ['metrics', 'health', 'api/auth/(.*)', '.well-known/(.*)', 'api/oidc/(.*)'],
|
||||
exclude: [
|
||||
{ path: 'metrics', method: RequestMethod.ALL },
|
||||
{ path: 'health', method: RequestMethod.ALL },
|
||||
{ path: 'api/auth/(.*)', method: RequestMethod.ALL },
|
||||
{ path: '.well-known/(.*)', method: RequestMethod.ALL },
|
||||
{ path: 'api/oidc/(.*)', method: RequestMethod.ALL },
|
||||
],
|
||||
});
|
||||
|
||||
const port = configService.get<number>('port') || 3001;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue