Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Use API Gateway as http proxy with uri (request path+variable query params) passthrough

I'm trying to do some vary basic routing with API Gateway. I need to achieve the following scenario:

  • user makes request xxxx-execute-api.eu-west-1.amazonaws.com/prod/api1/a/b/../n?param1=val1&parma2=val2...&paramn=valn request should go to api1.back.end/a/b/../n?param1=val1&parma2=val2...&paramn=valn

  • user makes request xxxx-execute-api.eu-west-1.amazonaws.com/prod/api2/a/b/../n?param1=val1&parma2=val2...&paramn=valn request should go to api2.back.end/a/b/../n?param1=val1&parma2=val2...&paramn=valn

  • user makes request xxxx-execute-api.eu-west-1.amazonaws.com/prod/*****/a/b/../n?param1=val1&parma2=val2...&paramn=valn request should go to api3.back.end/a/b/../n?param1=val1&parma2=val2...&paramn=valn

The routing should be done based on first path index after stage, and everything else after that should be passed to the http backend (like a transparent proxy).

In other words, if path index 1 is api1, forward request to api1.back.end with full URI after path index 1; if path index 1 is api2, forward request to api2.back.end with full URI after path index 1; if path index 1 is anything else than the explicit values api1 or api2, forward request to api3.back.end with full URI after path index 1;

How would I achieve this, without adding any extra layers (lambda, cloudfront, ec2, etc.) ?

Thank you!

like image 597
Stefan Bogdan Cimpeanu Avatar asked Apr 11 '26 08:04

Stefan Bogdan Cimpeanu


1 Answers

API Gateway does not support this use case today; each method and path must be explicitly defined in your API definition.

Supporting such passthrough proxies is a request we have heard from other customers and we may consider supporting it in future updates to the service.

UPDATE 09/20/2016: I'm happy to announce that we've launched a set of features to allow for proxying of requests as described above. See our announcement for more details.

like image 118
Bob Kinney Avatar answered Apr 13 '26 01:04

Bob Kinney