a REST service runs in EC2 in a private VPC. The request flow: API Gateway -> ELB -> Rest service. A custom domain, like public.aws.example.com, is set up for the API Gateway.
create a resource like /hello, adds a POST Integration request for the resource. In the Integration request methods, set below:
- select "VPC Link"
- enable "VPC proxy integration"
- HTTP method: "POST"
- VPC link: "[Use stage variable]"
- input: ${stageVariables.vpcLinkId}, the vpcLinkId is set in stage.
- Endpoint URL: http://prod-vpclink-rest.us-west-2.amazonaws.com/hello
The backend REST service receives the request from API Gateway, the request's url is http://prod-vpclink-rest.us-west-2.amazonaws.com/hello. How does API Gateway pass the original request url, like public.aws.example.com/hello, to the REST service?