Remove headers Cloudfront automatically includes in the response

0

Hi,

I've got a cloudfront distribution in front of an api that internally sends a request to an endpoint. This request includes the following headers :

user-agent content-length accept accept-encoding cloudfront-forwarded-proto cloudfront-is-desktop-viewer cloudfront-is-mobile-viewer cloudfront-is-smarttv-viewer cloudfront-is-tablet-viewer cloudfront-viewer-asn cloudfront-viewer-country content-type via x-amz-cf-id x-amzn-trace-id x-apigateway-context x-apigateway-event x-forwarded-for x-forwarded-host x-forwarded-port x-forwarded-proto

I need to remove some of them, but I can't find how. I've created a cloudfront policy to remove the x-apigateway-event but I still receive it on the target endpoint. The Api Gateway is configured as a Proxy integration, and the following message appears under "Integrations response":

Proxy integrations cannot be configured to transform responses.

Does it mean I cannot remove some headers the api gateway is including?

Thanks in advance!!

1回答
0

You can remove header from Response using a AWS CloudFront Response Headers Policy: https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/modifying-response-headers.html

In regards to AWS API Gateway Integration Response message "Proxy integrations cannot be configured to transform responses" means that you cannot modify the response header via AWS API Gateway, you must do it from the Service you're connected to, which is AWS Lambda.

AWS
vtjean
回答済み 1年前

ログインしていません。 ログイン 回答を投稿する。

優れた回答とは、質問に明確に答え、建設的なフィードバックを提供し、質問者の専門分野におけるスキルの向上を促すものです。

質問に答えるためのガイドライン

関連するコンテンツ