I have created an API using AWS api gateway which contains a mock endpoint /test
.
In my response, I get the headers x-amzn-RequestId
and x-amz-apigw-id
. In case of an error, e.g. using a non existing endpoint /test2
, I also get the x-amazn-ErrorType
header.
I don't want these aws headers to be in my api response. How can these be removed?
Add CloudFront in front of your API Gateway. Then add a Lambda@Edge function for either origin response or viewer response to remove these attributes from the array.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With