Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Path parameters ignored by AWS API Gateway using proxy+

I have a REST API on the AWS API Gateway. It has one resource, /{proxy+}, that is configured with the ANY method. The integration request is setup to be a VPC_PROXY, meaning its using a VPC Link. The VPC link is to a network load balancer that is fronting an app I have running on an ECS cluster using Fargate.

When using the console's option to test the API, I can confirm that requests are reaching my app but the resource being requested is always / according to my logging. If I attempt to set the {proxy} value in the method test screen on the console, it seems like my app only ever gets requests for /. If I set {proxy} to something like widget/5, the response I receive is as if I was request /.

I'm wondering if there is some way to troubleshoot this, scouring the AWS documentation I can't figure out where I'm going wrong with my setup.

like image 348
Flynn81 Avatar asked Jul 31 '26 23:07

Flynn81


1 Answers

In your integration, the endpoint URL should be http://loadbalancerurl/{proxy}. I couldn't find any documentation specifically for VPC Link integration, but there is a tutorial for HTTP proxy integration which has similar steps.

If you are using openapi spec, the integration section would look something like this:

x-amazon-apigateway-integration:
  uri: "http://loadbalancerurl/{proxy}"
  responses:
    default:
      statusCode: "200"
  requestParameters:
    integration.request.path.proxy: "method.request.path.proxy"
  passthroughBehavior: "when_no_match"
  connectionType: "VPC_LINK"
  connectionId: "your-vpclink-id"
  httpMethod: "ANY"
  type: "http_proxy"

When using the console, integration.request.path.proxy: "method.request.path.proxy" mapping was added automatically when I added {proxy} to my endpoint URL.

like image 197
Kaustubh Khavnekar Avatar answered Aug 02 '26 20:08

Kaustubh Khavnekar