fix: Add global OPTIONS route for CORS preflight handling
This commit is contained in:
@@ -19,6 +19,11 @@ AppConfig::loadEnv(__DIR__ . '/..');
|
|||||||
// Bootstrap application
|
// Bootstrap application
|
||||||
$app = AppBootstrap::create();
|
$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
|
// Root route - redirect to docs
|
||||||
$app->get('/', function ($request, $response) {
|
$app->get('/', function ($request, $response) {
|
||||||
return $response
|
return $response
|
||||||
|
|||||||
Reference in New Issue
Block a user