diff --git a/libs/nextjs/package.json b/libs/nextjs/package.json index 9e9323b..55ead0b 100644 --- a/libs/nextjs/package.json +++ b/libs/nextjs/package.json @@ -1,7 +1,7 @@ { "name": "@fal-ai/serverless-nextjs", "description": "The fal-serverless Next.js integration", - "version": "0.2.1", + "version": "0.2.2", "license": "MIT", "repository": { "type": "git", diff --git a/libs/nextjs/src/handler.ts b/libs/nextjs/src/handler.ts index 6de92c0..007541f 100644 --- a/libs/nextjs/src/handler.ts +++ b/libs/nextjs/src/handler.ts @@ -71,9 +71,18 @@ export const handler: NextApiHandler = async (request, response) => { return; } + // pass over headers prefixed with x-fal-* + const headers: Record = {}; + Object.keys(request.headers).forEach((key) => { + if (key.toLowerCase().startsWith('x-fal-')) { + headers[key.toLowerCase()] = request.headers[key]; + } + }); + const res = await fetch(targetUrl, { method: request.method, headers: { + ...headers, authorization: `Key ${falKey}`, accept: 'application/json', 'content-type': 'application/json',