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 Resposta
0
Resposta aceita

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"
respondido há 4 meses
profile pictureAWS
ESPECIALISTA
avaliado há 4 meses

Você não está conectado. Fazer login para postar uma resposta.

Uma boa resposta responde claramente à pergunta, dá feedback construtivo e incentiva o crescimento profissional de quem perguntou.

Diretrizes para responder a perguntas