fix(api): 🐛 Respond to OPTIONS requests with empty CORS response

This commit is contained in:
Jesse Wierzbinski 2024-05-06 08:54:57 +00:00
parent e6749d9b72
commit de4381e151
No known key found for this signature in database

View file

@ -1,6 +1,6 @@
import { dualLogger } from "@loggers";
import { connectMeili } from "@meilisearch";
import { errorResponse } from "@response";
import { errorResponse, response } from "@response";
import { config } from "config-manager";
import { Hono } from "hono";
import { LogLevel, LogManager, type MultiLogManager } from "log-manager";
@ -124,6 +124,10 @@ for (const [route, path] of Object.entries(routes)) {
route.default(app);
}
app.options("*", async () => {
return response(null);
});
app.all("*", async (context) => {
if (config.frontend.glitch.enabled) {
const glitch = await handleGlitchRequest(context.req.raw, dualLogger);