The AWS Lambda plugin is not adding the `X-Forwarded-*` headers to requests

Uses: Kong Gateway
TL;DR

Why doesn’t the AWS Lambda plugin add X-Forwarded-* headers to requests?

Nginx’s proxy module normally adds X-Forwarded-* headers as traffic passes through Kong Gateway. The AWS Lambda plugin doesn’t use that path — it calls the Lambda function directly using lua-resty-http as an HTTP client, so X-Forwarded-* headers are never added to the outbound request.

Problem

When using the AWS Lambda plugin we noticed that the X-Forwarded-* headers are missing. Being as the Gateway is acting as a proxy, why are these not added?

Solution

These headers are added by the nginx proxy module when traffic traverses the Gateway. However, when using the lambda plugin it does not follow this same path. The plugin instead uses lua-resty-http as an HTTP client to call the AWS Lambda function. As a result, none of the X-Forwarded-* headers will be added to these outbound requests.

Help us make these docs great!

Kong Developer docs are open source. If you find these useful and want to make them better, contribute today!