how to pass the original url from API Gateway to the backend service

0

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:

  1. select "VPC Link"
  2. enable "VPC proxy integration"
  3. HTTP method: "POST"
  4. VPC link: "[Use stage variable]"
  5. input: ${stageVariables.vpcLinkId}, the vpcLinkId is set in stage.
  6. 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?

1개 답변
0
수락된 답변

the answer is similar with https://repost.aws/knowledge-center/forward-host-header-api-gateway

basically two steps:

  1. In Method Request, add HTTP Request Headers as host.
  2. In Integration Request, "URL request headers parameters", add "Name" like 'x-org-url', "Mapped from" input "method.request.header.host"
답변함 4달 전
profile pictureAWS
전문가
검토됨 4달 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠