I have a Python application running on AWS Lambda and exposed through AWS API Gateway. In my handler class, I have defined an endpoint as @api.route(/api/v1/dep/<path:data>)
, and in my Terraform configuration file, specifically the api-gateway-vars.tf, I have defined the lambda path as
"/api/v1/dep/{proxy+}":
{
"methods" : ["get"], "requireApiKey" : "false", "authorizer" : "false",
"lambda" : "something", "lambdaEnvVars" : {}
}
The problem I am facing is that API Gateway only accepts the path without a trailing slash (/) and returns a 404 error when I try to access the same endpoint with the trailing slash. However, I want API Gateway to handle both cases, allowing the endpoint to be accessed with or without the trailing slash. For eg. /api/v1/dep/top
and /api/v1/dep/top/
Could anyone please share what is missing here?