aws / aws/chalice

Why doesn't {proxy+} work as catchall ?

Open
#2,072 2 comments 1 reaction 0 assignees View on GitHub
Dominant language
Python
Stars
11.1k
Forks
1k
Avg merge
1d 22h
Merged PRs (30d)
2

Description

```from chalice import Chalice

app = Chalice(app_name='chalice-proxy-example')

@app.route('/')
def index():
return {"message": "Welcome to the root endpoint!"}

@app.route('/resource/{proxy+}', methods=['GET', 'POST'])
def resource_proxy(proxy):
# proxy contains the path information.
# For instance, if you access /resource/a/b/c, proxy will be "a/b/c"
return {
"message": "You've accessed the proxy endpoint.",
"path": proxy
}

```

I have tried all combinations and I can't figure out why a generic catch all work. I probably miss something super basic, but at a point where I may have to move to something else. This is such a super great framework, if I could get a reverse proxy type setup working! Can anyone help please ?
```
$ curl http://127.0.0.1:8000/
{"message":"Welcome to the root endpoint!"}

$ curl http://127.0.0.1:8000/1
{"message": "Missing Authentication Token"}

On chalice, I see 127.0.0.1 - - [09/Sep/2023 15:02:09] "GET /1 HTTP/1.1" 403 -
```

Contributor guide

Open the contributing guide

Research direction

Start with the route declaration in the issue and the local server's request-matching behavior. Compare the declared /resource/{proxy+} route with requests to /1 and /resource/a/b/c, then check the relevant routing documentation or tests. Done means the intended catch-all behavior is either confirmed with a working request or clearly documented as unsupported.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, python
Domain
api, backend, cloud
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.