xraysink
xraysink copied to clipboard
Problem getting host when running under http/2
Using HTTP2 to an AWS ELBv2 in front of an ECS Service:
File "/opt/venv/lib/python3.9/site-packages/starlette/middleware/base.py", line 30, in coro
await self.app(scope, request.receive, send_stream.send)
File "/opt/venv/lib/python3.9/site-packages/starlette/middleware/base.py", line 55, in __call__
response = await self.dispatch_func(request, call_next)
File "/opt/venv/lib/python3.9/site-packages/xraysink/asgi/middleware.py", line 46, in xray_middleware
request.headers["host"].split(":", 1)[0], xray_recorder
File "/opt/venv/lib/python3.9/site-packages/starlette/datastructures.py", line 542, in __getitem__
raise KeyError(key)
KeyError: 'host'
Other dependencies
- FastApi v0.70.0
- uvicorn v0.17.4
- no gunicorn
Research:
- ASGI scope spec for HTTP/1
- How to use curl with http/2, for testing
- Section 7.2 of HTTP RFC describes the
:authorityheader