{proxy+} path glob not working in local chalice server
- Dominant language
- Python
- Stars
- 11.1k
- Forks
- 1k
- Avg merge
- 1d 22h
- Merged PRs (30d)
- 2
Description
From what I can tell, at least with chalice `1.31.2`, the `{proxy+}` glob seems to be broken in the local development server, even though it works properly in AWS. When I try to use nested URLs with this code:
```python
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():
return {
"message": "You've accessed the proxy endpoint.",
"path": app.current_request.uri_params.get("proxy+")
}
```
This happens:
```
curl http://127.0.0.1:8000/resource/good
127.0.0.1 - - [18/Sep/2024 15:34:52] "GET /resource/good HTTP/1.1" 200 -
{"message":"You've accessed the proxy endpoint.","path":"good"}
curl http://127.0.0.1:8000/resource/still_good/
127.0.0.1 - - [18/Sep/2024 15:36:40] "GET /resource/still_good/ HTTP/1.1" 200 -
{"message":"You've accessed the proxy endpoint.","path":"still_good"}
curl http://127.0.0.1:8000/resource/should_work/but_doesnt
127.0.0.1 - - [18/Sep/2024 15:35:07] "GET /resource/should_work/but_doesnt HTTP/1.1" 403 -
{"message": "Missing Authentication Token"}
curl http://127.0.0.1:8000/resource/should_work/but_doesnt/
127.0.0.1 - - [18/Sep/2024 15:35:10] "GET /resource/should_work/but_doesnt/ HTTP/1.1" 403 -
{"message": "Missing Authentication Token"}
```
When deployed to AWS, this works perfectly fine. However, in the chalice local server, it won't route.
The weird thing is, I pretty much can't find **any** documentation for how `{proxy+}` is supposed to work Chalice. BUT, we have lots of code running the uses it. Is it some weird loophole? The more I try to figure out whats going on, the more lost I get.
Contributor guide
Research direction
Reproduce the reported routes with the Chalice local development server, starting at the app.route('/resource/{proxy+}') entry point and comparing single- and multi-segment paths. Trace the local server's route matching for nested proxy paths; done when those paths route locally with the same response behavior as the deployed AWS version.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- aws, python
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100