Thanks to visit codestin.com
Credit goes to github.com

Skip to content

bug: apigatewayv2 http proxy not working with request path #12665

Closed
@rafaelleyva

Description

@rafaelleyva

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

I want to create an http proxy using apigatewayv2 service, I have created the API, integration and route as follows:

export APIID=$(aws --profile localstack --endpoint-url https://localhost.localstack.cloud:4566 --region us-east-1 apigatewayv2 create-api --name testGatewayProxy --protocol-type HTTP --target "http://wsapi-gw:80" --query 'ApiId' --output text)

export INTEGRATIONID=$(aws --profile localstack --endpoint-url https://localhost.localstack.cloud:4566 --region us-east-1 apigatewayv2 create-integration --api-id $APIID --integration-type HTTP_PROXY --integration-uri "http://wsapi-gw:80" --integration-method ANY --payload-format-version "1.0" --query 'IntegrationId' --output text)

aws --profile localstack --endpoint-url https://localhost.localstack.cloud:4566 --region us-east-1 apigatewayv2 create-route --api-id  $APIID  --route-key "ANY /stolenid/breach/search" --target integrations/$INTEGRATIONID

aws --profile localstack --endpoint-url https://localhost.localstack.cloud:4566 --region us-east-1 apigatewayv2 create-stage --api-id $APIID --stage-name proxy --auto-deploy

The issue is that my route is not being forwarded to the backend service. It doesn't matter whether I use an specific route or the /{proxy+} route. I tried adding ${request.path} to the nitegration uri but that does not work neither. I am always hitting / or /$%7Brequest.path%7D in my backend.

Expected Behavior

the api call path must be forwarded to the backend call.

How are you starting LocalStack?

With a docker-compose file

Steps To Reproduce

How are you starting localstack (e.g., bin/localstack command, arguments, or docker-compose.yml)

docker run localstack/localstack

Client commands (e.g., AWS SDK code snippet, or sequence of "awslocal" commands)

export APIID=$(aws --profile localstack --endpoint-url https://localhost.localstack.cloud:4566 --region us-east-1 apigatewayv2 create-api --name testGatewayProxy --protocol-type HTTP --target "http://wsapi-gw:80" --query 'ApiId' --output text)

export INTEGRATIONID=$(aws --profile localstack --endpoint-url https://localhost.localstack.cloud:4566 --region us-east-1 apigatewayv2 create-integration --api-id $APIID --integration-type HTTP_PROXY --integration-uri "http://wsapi-gw:80" --integration-method ANY --payload-format-version "1.0" --query 'IntegrationId' --output text)

aws --profile localstack --endpoint-url https://localhost.localstack.cloud:4566 --region us-east-1 apigatewayv2 create-route --api-id $APIID --route-key "ANY /stolenid/breach/search" --target integrations/$INTEGRATIONID

aws --profile localstack --endpoint-url https://localhost.localstack.cloud:4566 --region us-east-1 apigatewayv2 create-stage --api-id $APIID --stage-name proxy --auto-deploy

Environment

- OS: Ubuntu
- LocalStack:pro
  LocalStack version: 4.4.0
  LocalStack Docker image sha:
  LocalStack build date: 2025-05-08
  LocalStack build git hash: b0d9b9da1

Anything else?

No response

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions