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!!

Pascual
已提问 1 年前509 查看次数
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 年前

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。

回答问题的准则