1
votes

I'm exploring options to invoke a lambda function via an HTTP call using AWS api gateway. I have an existing Nginx load balancer, serving micro services. When I try to add a location block adding a proxy pass to the aws api gateway,

location /foo {
  proxy_pass <aws api gateway url>;
}

this is resolving the hostname to IP eg: 10.20.30.40, but AWS API gateway is returning 400 Bad Request when querying directly from the IP.

Is there any way I can invoke lambda using AWS API gateway from my existing nginx server?

1
Does this work if you use the deployed URL and not the ARN? - Bob Kinney
edited the question, I'm using the URL. - Gaurav Reddy

1 Answers

1
votes

As you noted, API Gateway will return an error if you try to access by IP. You must configure your proxy to send the Host header as if you were accessing the API directly. According to the nginx documentation this is achieved via the proxy_pass_header directive.