api: edge proxy must not claim OPTIONS /* (cors preflight owns it)
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
1 changed file +2 −0
modified
apps/api/src/api/server.ts
+2 −0
@@ -95,6 +95,8 @@ export async function buildServer(): Promise<FastifyInstance> { | ||
| 95 | 95 | rewritePrefix: "/", |
| 96 | 96 | websocket: false, |
| 97 | 97 | http2: false, |
| 98 | + // @fastify/cors already owns OPTIONS /* (preflight) — proxy every other method. | |
| 99 | + httpMethods: ["GET", "HEAD", "POST", "PUT", "PATCH", "DELETE"], | |
| 98 | 100 | replyOptions: { rewriteRequestHeaders: (req, headers) => ({ ...headers, "x-forwarded-host": req.headers.host ?? "", "x-forwarded-proto": (req.headers["x-forwarded-proto"] as string) ?? "https" }) }, |
| 99 | 101 | }); |
| 100 | 102 | logger.info({ upstream: config.webUpstream }, "edge mode: proxying non-API paths to the web app"); |
| 101 | 103 | |