diff --git a/app/Http/Middleware/ApiKeyMiddleware.php b/app/Http/Middleware/ApiKeyMiddleware.php index 666b89fc..707ce3ce 100644 --- a/app/Http/Middleware/ApiKeyMiddleware.php +++ b/app/Http/Middleware/ApiKeyMiddleware.php @@ -16,18 +16,20 @@ public function handle(Request $request, Closure $next) { // 화이트리스트(인증 예외 라우트) - API Key 검증 제외 $publicRoutes = [ - '/', // Root (Swagger redirect) + '/', // Root (Swagger redirect) 'api/v1/signup', 'api/v1/register', 'api/v1/refresh', 'api/v1/debug-apikey', - 'api/v1/internal/*', // 내부 서버간 통신 (HMAC 인증 사용) - 'api-docs', // Swagger UI - 'api-docs/*', // Swagger 하위 경로 - 'docs', // L5-Swagger UI - 'docs/*', // L5-Swagger 하위 경로 (에셋 등) - 'docs/api-docs.json', // Swagger JSON - 'up', // Health check + 'api/v1/internal/*', // 내부 서버간 통신 (HMAC 인증 사용) + 'api-docs', // Swagger UI (정적) + 'api-docs/*', // Swagger 하위 경로 + 'docs', // L5-Swagger UI + 'docs/*', // L5-Swagger 하위 경로 (에셋 등) + 'docs/api-docs.json', // Swagger JSON (기본) + 'docs/api-docs-v1.json', // Swagger JSON (v1) + 'api/documentation/*', // L5-Swagger v1 문서 + 'up', // Health check ]; $currentRoute = $request->route()?->uri() ?? $request->path(); diff --git a/public/api-docs/index.html b/public/api-docs/index.html index e819a6b4..2f0edf20 100644 --- a/public/api-docs/index.html +++ b/public/api-docs/index.html @@ -7,7 +7,7 @@ where('path', '.*'); +// Swagger v1 JSON (api-docs-v1.json 직접 제공) +Route::get('/docs/api-docs-v1.json', function () { + $path = storage_path('api-docs/api-docs-v1.json'); + if (! file_exists($path)) { + abort(404); + } + return response()->file($path, ['Content-Type' => 'application/json']); +}); + // R2 파일 프록시 (file_id 기반, 인증 불필요, 캐시 1일) Route::get('/files/{id}/view', function (int $id) { - $file = \App\Models\File::find($id); + $file = \App\Models\Commons\File::find($id); if (! $file || ! $file->file_path) { abort(404); }