xraysink icon indicating copy to clipboard operation
xraysink copied to clipboard

Problem getting host when running under http/2

Open garyd203 opened this issue 3 years ago • 0 comments

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:

garyd203 avatar Mar 02 '22 04:03 garyd203