1
votes

I'm running a Flask-application on AWS-Lambda based on this tutorial: https://andrewgriffithsonline.com/blog/180412-deploy-flask-api-any-serverless-cloud-platform/#create-flask-app

My problem now is that this setup works absolutely fine for the defined home-path ("/"), but whenever I call e.g. "/user/7" the API-Gatway returns 403, since it doesn't know the route, although it is defined in the Flask-Lambda.

Is there a possibility to setup API-Gateway in a way to pass the whole request through to the Lambda, regardless of whatever path the request has?

1

1 Answers

1
votes

You can use the {proxy+} path to act as a catch all for API Gateway.

By creating the proxy resource anything that matches the prefix will automatically use that resource, if you add it to the root resource then it will process all other requests that do not match a specific URL pattern.

You could also use variables in your path resource names, for your user method for example the path would end up being /user/{userId}. This is the preferable solution as it is still being specific to the request type.

More information is available here.