diff --git a/backend/package.json b/backend/package.json index d07769d..e3d3af1 100644 --- a/backend/package.json +++ b/backend/package.json @@ -1,6 +1,6 @@ { "name": "calendar-run-backend", - "version": "1.2.0", + "version": "1.2.1", "private": true, "scripts": { "build": "tsc", diff --git a/backend/src/app.ts b/backend/src/app.ts index 484c433..56597ed 100644 --- a/backend/src/app.ts +++ b/backend/src/app.ts @@ -7,6 +7,25 @@ import racesRouter from "./routes/races"; export function createApp(): express.Express { const app = express(); + // TEMP: compare Host vs Origin for 200 vs 401 debugging — remove when done + app.use((req, res, next) => { + const host = req.headers.host; + const origin = req.headers.origin; + res.on("finish", () => { + console.log( + JSON.stringify({ + tag: "temp-req-headers", + host, + origin: origin ?? null, + method: req.method, + path: req.originalUrl ?? req.url, + status: res.statusCode, + }), + ); + }); + next(); + }); + app.use( cors({ origin: config.corsOrigin, methods: ["GET", "POST", "PATCH", "DELETE", "OPTIONS"] }), );