fix: Add global OPTIONS route for CORS preflight handling

This commit is contained in:
mwpn
2025-12-17 14:18:21 +07:00
parent 359def592d
commit 37098f4518

View File

@@ -19,6 +19,11 @@ AppConfig::loadEnv(__DIR__ . '/..');
// Bootstrap application
$app = AppBootstrap::create();
// Global OPTIONS route for CORS preflight (must be before other routes)
$app->options('/{routes:.+}', function ($request, $response) {
return $response->withStatus(204);
});
// Root route - redirect to docs
$app->get('/', function ($request, $response) {
return $response