diff --git a/src/next-edge-app/index.ts b/src/next-edge-app/index.ts index 4dda803..8f99fd7 100644 --- a/src/next-edge-app/index.ts +++ b/src/next-edge-app/index.ts @@ -79,6 +79,17 @@ export function createApiHandler(options: CreateApiHandlerOptions) { requestHeaders.set("Ory-Base-URL-Rewrite", "false") requestHeaders.set("Ory-No-Custom-Domain-Redirect", "true") + // Only effective in CI. + if ( + process.env.ORY_CI_RATE_LIMIT_HEADER && + process.env.ORY_CI_RATE_LIMIT_HEADER_VALUE + ) { + requestHeaders.set( + process.env.ORY_CI_RATE_LIMIT_HEADER, + process.env.ORY_CI_RATE_LIMIT_HEADER_VALUE, + ) + } + try { const response = await fetch(url, { method: request.method, diff --git a/src/next-edge/index.ts b/src/next-edge/index.ts index 3c9bed9..fee5806 100644 --- a/src/next-edge/index.ts +++ b/src/next-edge/index.ts @@ -115,6 +115,17 @@ export function createApiHandler(options: CreateApiHandlerOptions) { headers.set("Ory-Base-URL-Rewrite", "false") headers.set("Ory-No-Custom-Domain-Redirect", "true") + // Only effective in CI. + if ( + process.env.ORY_CI_RATE_LIMIT_HEADER && + process.env.ORY_CI_RATE_LIMIT_HEADER_VALUE + ) { + headers.set( + process.env.ORY_CI_RATE_LIMIT_HEADER, + process.env.ORY_CI_RATE_LIMIT_HEADER_VALUE, + ) + } + const response = await fetch(url, { method: req.method, headers, diff --git a/src/type/create-api-handler-options.ts b/src/type/create-api-handler-options.ts index 79637d5..15e5980 100644 --- a/src/type/create-api-handler-options.ts +++ b/src/type/create-api-handler-options.ts @@ -39,7 +39,7 @@ export interface CreateApiHandlerOptions { */ fallbackToPlayground?: boolean - /* + /** * Per default headers are filtered to forward only a fixed list. * * If you need to forward additional headers you can use this setting to define them.