Explore Courses Blog Tutorials Interview Questions
0 votes
1 view
in AWS by (19.1k points)

My API Gateway/Lambda setup returns an http response header: Lamdba uses a callback function to return the value as part of a json and the Integration Response maps it into a header (using integration.response.body)

With this solution, the values are sent back both in the body and the header.

How can I map headers from the Lambda response without duplicating the values in the response body?

1 Answer

0 votes
by (44.3k points)

You will be able to set the response headers as part of Lambda output when you have enabled the Lambda proxy integration. Then API Gateway will return those as a part of the HTTP response to the client.

Node.js example:

callback(null, {

    "isBase64Encoded": false, // Set to `true` for binary support.

    "statusCode": 200,

    "headers": {

        "header1Name": "header1Value",

        "header2Name": "header2Value",


    "body": "...",


if no extra response headers are returned, the headers can be null or unspecified.

Check this doc for more: Output Format of a Lambda Function for Proxy Integration

Related questions

Welcome to Intellipaat Community. Get your technical queries answered by top developers!

28.4k questions

29.7k answers


94.2k users

Browse Categories