# CloudFrontResponse

**Kind:** Interface

**Source:** [`src/adapter/lambda-edge/handler.ts`](https://github.com/honojs/hono/blob/main/src/adapter/lambda-edge/handler.ts#L56)

**Part of:** [Adapter](subsystem-src-adapter)

`CloudFrontResponse` represents the response object returned by a Lambda@Edge handler. It carries CloudFront-formatted headers and string status details that CloudFront reads when sending a response.

## Properties

| Property | Type |
|---|---|
| `headers` | `CloudFrontHeaders` |
| `status` | `string` |
| `statusDescription` | `string` |

## Diagram

```mermaid
graph LR
  Handler[Lambda Edge Handler] --> Response[CloudFrontResponse]
  Response --> Headers[CloudFrontHeaders]
  Response --> Status[status]
  Response --> Description[statusDescription]
  Response --> CloudFront[CloudFront]
```

## Usage

```ts
import type { CloudFrontHeaders, CloudFrontResponse } from './handler';

function createResponse(
  headers: CloudFrontHeaders,
  status: string,
  statusDescription: string,
): CloudFrontResponse {
  return {
    headers,
    status,
    statusDescription,
  };
}

const response = createResponse(
  requestHeaders,
  responseStatus,
  responseDescription,
);
```

## AI Coding Instructions

- Return `CloudFrontResponse` from Lambda@Edge handlers when constructing a CloudFront response.
- Keep `headers` in the `CloudFrontHeaders` format expected by CloudFront.
- Set both `status` and `statusDescription` as strings.
- Preserve header names and values required by the response path.

## How it works

`CloudFrontResponse` is an exported TypeScript interface for the optional `response` member of a CloudFront event record’s `cf` object. [src/adapter/lambda-edge/handler.ts:56-60](src/adapter/lambda-edge/handler.ts#L56-L60) [src/adapter/lambda-edge/handler.ts:69-75](src/adapter/lambda-edge/handler.ts#L69-L75)

- `headers` is required and maps header names to arrays of `{ key, value }` entries, allowing multiple values for one header name. [src/adapter/lambda-edge/handler.ts:10-17](src/adapter/lambda-edge/handler.ts#L10-L17) [src/adapter/lambda-edge/handler.ts:56-58](src/adapter/lambda-edge/handler.ts#L56-L58)
- `status` is required and typed as a string. `statusDescription` is optional and typed as a string. [src/adapter/lambda-edge/handler.ts:56-60](src/adapter/lambda-edge/handler.ts#L56-L60)
- It declares no body or body-encoding fields. [src/adapter/lambda-edge/handler.ts:56-60](src/adapter/lambda-edge/handler.ts#L56-L60)

When `handle()` invokes the Hono application, it places the incoming event’s optional `cf.response` value in the fetch context as `response`. [src/adapter/lambda-edge/handler.ts:128-141](src/adapter/lambda-edge/handler.ts#L128-L141) The adapter does not otherwise read, validate, transform, or return that value in this file; response conversion instead operates on the `Response` returned by the application and creates a separate internal `CloudFrontResult` shape. [src/adapter/lambda-edge/handler.ts:149-162](src/adapter/lambda-edge/handler.ts#L149-L162)
