How can I let API gateway forward the path to down stream application?

Viewed 1426

I build an API gateway in AWS and use /{proxy+} to forward all requests under the path / to my down stream ALB (ALB_ENDPOINT). But I found API gateway doesn't keep the path during forwarding. For example, if users requset APIGATEAY_ENDPOINT/abc to API gateway, it will forward it to ALB_ENDPOINT/ instead of ALB_ENDPOINT/abc. It seems API gateway removes the path from the endpoint.

How can I make API gateway persists the path when it forwards it to downstream application?

1 Answers

If we define a /{proxy+} like this:

enter image description here

proxy will be the path parameter of the request and entire path can be appended to integration endpoint by simply adding /{proxy} at the end of the url and mapping that proxy from method.request.path.proxy

We need to add /{proxy} at the end of the endpoint url

enter image description here

Here is the tutorial for HTTP Api

enter image description here

Related