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...¶mn=valn request should go to api1.back.end/a/b/../n?param1=val1&parma2=val2...¶mn=valn
user makes request xxxx-execute-api.eu-west-1.amazonaws.com/prod/api2/a/b/../n?param1=val1&parma2=val2...¶mn=valn request should go to api2.back.end/a/b/../n?param1=val1&parma2=val2...¶mn=valn
user makes request xxxx-execute-api.eu-west-1.amazonaws.com/prod/*****/a/b/../n?param1=val1&parma2=val2...¶mn=valn request should go to api3.back.end/a/b/../n?param1=val1&parma2=val2...¶mn=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!