Jelle
Jelle

Reputation: 1060

How do I manipulate requests and response headers in AWS Api Gatway using Lambda?

I want to create an API Gateway HTTP integration (reverse proxy) but manipulate the header and response headers.

I know that I can use template mappings but this only supports very simple replace functionality.

For my project I need to do a database lookup to fill in a certain request header. Ideally a Lambda function would do this but I can not see a way to use a Lambda function to manipulate headers in combination with the HTTP integration.

The only other option I see is to use Lambda integration and create a whole reverse proxy integration myself in this Lambda. I would like to avoid this.

Any options someone can think off?

Upvotes: 0

Views: 452

Answers (1)

Marcin
Marcin

Reputation: 238219

You can front your API gateway with CloudFront. This allows you to manipulate http requests before they reach your API through CloudFront function or lambda@edge. Both of them can be lambda functions.

Upvotes: 1

Related Questions