Setting http response header from AWS lambda

Saar :

My API Gateway/Lambda setup returns an HTTP response header: Lambda uses callback function to return the value as part of a JSON and the Integration Response maps it into a HTTP 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?

Khalid T. :

If you have Lambda proxy integration enabled, you can set the response headers as part of Lambda output and API Gateway will return them as 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": "...",
});

where headers、追加の応答ヘッダーが返されない場合、nullまたは未指定することできます

プロキシ統合のためのLambda関数の出力形式を参照してください

この記事はインターネットから収集されたものであり、転載の際にはソースを示してください。

侵害の場合は、連絡してください[email protected]

編集
0

コメントを追加

0

関連記事

分類Dev

Setting http response header from AWS lambda

分類Dev

Setting Cookie in http response header from AWS lambda Node JS

分類Dev

In AWS Lambda, setting a header attribute with a variable

分類Dev

How to add CORS header to AWS API Gateway response with lambda proxy integration activate

分類Dev

AWS Lambda to SNS response after invocation

分類Dev

Invoke a AWS Lambda function by a http request

分類Dev

HTTP Post request not going through in AWS Lambda

分類Dev

Setting up Lambda to Create AWS CloudFormation without IAM Policy

分類Dev

AWS Lex: An error has occurred: Invalid Lambda Response: Lambda response elicited for an invalid slot name

分類Dev

未定義の変数:$ http_response_header

分類Dev

Synchronous call from AWS Lambda to Athena

分類Dev

Returning Value from HTTP Response in Java

分類Dev

Checking if response is 200 from HTTP POST request

分類Dev

Get response from a HTTP request in ionic

分類Dev

AWS Lambda HTTP POST Request (Node.js)

分類Dev

Publish mqtt message to topic from aws lambda using aws iot

分類Dev

How do I determine the path or action for my Lambda when setting up AWS API Gateway through the CLI?

分類Dev

Combined response from multiple HTTP request from a loop

分類Dev

JavaのAWS Lambda関数にAccess-control-headerを含める

分類Dev

Response header duplicated (Lumen)

分類Dev

Access AWS S3 from Lambda within VPC

分類Dev

Access AWS S3 from Lambda within VPC

分類Dev

Access AWS S3 from Lambda within VPC

分類Dev

Can not use zip from S3 for AWS Lambda

分類Dev

SIGSEGV from spawn child_process in AWS Lambda function

分類Dev

accessing origin URL from AWS lambda@edge

分類Dev

Invoke AWS Lambda with Amazon SNS from Different Accounts?

分類Dev

Testing module that requires a module from a layer in AWS Lambda

分類Dev

AWS Secrets Manager call from Lambda returning null/none

Related 関連記事

  1. 1

    Setting http response header from AWS lambda

  2. 2

    Setting Cookie in http response header from AWS lambda Node JS

  3. 3

    In AWS Lambda, setting a header attribute with a variable

  4. 4

    How to add CORS header to AWS API Gateway response with lambda proxy integration activate

  5. 5

    AWS Lambda to SNS response after invocation

  6. 6

    Invoke a AWS Lambda function by a http request

  7. 7

    HTTP Post request not going through in AWS Lambda

  8. 8

    Setting up Lambda to Create AWS CloudFormation without IAM Policy

  9. 9

    AWS Lex: An error has occurred: Invalid Lambda Response: Lambda response elicited for an invalid slot name

  10. 10

    未定義の変数:$ http_response_header

  11. 11

    Synchronous call from AWS Lambda to Athena

  12. 12

    Returning Value from HTTP Response in Java

  13. 13

    Checking if response is 200 from HTTP POST request

  14. 14

    Get response from a HTTP request in ionic

  15. 15

    AWS Lambda HTTP POST Request (Node.js)

  16. 16

    Publish mqtt message to topic from aws lambda using aws iot

  17. 17

    How do I determine the path or action for my Lambda when setting up AWS API Gateway through the CLI?

  18. 18

    Combined response from multiple HTTP request from a loop

  19. 19

    JavaのAWS Lambda関数にAccess-control-headerを含める

  20. 20

    Response header duplicated (Lumen)

  21. 21

    Access AWS S3 from Lambda within VPC

  22. 22

    Access AWS S3 from Lambda within VPC

  23. 23

    Access AWS S3 from Lambda within VPC

  24. 24

    Can not use zip from S3 for AWS Lambda

  25. 25

    SIGSEGV from spawn child_process in AWS Lambda function

  26. 26

    accessing origin URL from AWS lambda@edge

  27. 27

    Invoke AWS Lambda with Amazon SNS from Different Accounts?

  28. 28

    Testing module that requires a module from a layer in AWS Lambda

  29. 29

    AWS Secrets Manager call from Lambda returning null/none

ホットタグ

アーカイブ