Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Proxy Forwarding with 1 resource and route inside Chalice #1959

Open
AndreuJove opened this issue Aug 18, 2022 · 1 comment
Open

Proxy Forwarding with 1 resource and route inside Chalice #1959

AndreuJove opened this issue Aug 18, 2022 · 1 comment

Comments

@AndreuJove
Copy link

AndreuJove commented Aug 18, 2022

Dear chalice,

I was wondering if it's possible to have only one resource in the API GATEWAY using {proxy+} integration and route the traffic inside chalice.

The point is not to create each time a new resource for each endpoint (new infrastructure to deploy). I wan't to manage the routes inside my chalice application.

When I try to route using:

@app.route('/a', methods=["GET"])
def a():
    return {
        'statusCode': 200,
        'body': json.dumps('Hello a!')
    }

The response recieved is:

{
  "Code": "MethodNotAllowedError",
  "Message": "Unsupported method: GET"
}

When accessing the index it works:

@app.route('/')
def index():
    return {
        'statusCode': 200,
        'body': json.dumps('Hola chalice!')
    }

Response:

{
  "statusCode": 200,
  "body": "\"Hola chalice!\""
}

The proxy configuration that I would like to use:
image

Thanks a lot!!!!

@annjawn
Copy link

annjawn commented Mar 18, 2023

+1

I am wondering the same thing. It seems a bit counter intuitive to be creating ALL the routes in API Gateway if Chalice can handle the routing within the App. A greedy catch all {proxy+} should be supported. This comment indicates a possible workaround, but it really is just a workaround. There is a PR by @jacobe but I don't think it has been merged.

In my case, I am not using Chalice CLI or Chalice CDK Construct for Deployment, since I want to control the API configuration so we are shipping with our own CDK App that creates all the resources along with API Gateway. It looks like it's not possible to use {proxy+}.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants