You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using django-revproxy with Uvicorn I get the below RuntimeError when trying to access a view inheriting from ProxyView. This is not the case when using Daphne as a server. Uvicorn seems to be very strict with Content-Length. Is there a workaround?
ERROR: Exception in ASGI application
Traceback (most recent call last):
File "/opt/pysetup/.venv/lib/python3.12/site-packages/uvicorn/protocols/http/httptools_impl.py", line 399, in run_asgi
result = await app( # type: ignore[func-returns-value]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/pysetup/.venv/lib/python3.12/site-packages/uvicorn/middleware/proxy_headers.py", line 70, in __call__
return await self.app(scope, receive, send)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/pysetup/.venv/lib/python3.12/site-packages/channels/routing.py", line 62, in __call__
return await application(scope, receive, send)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/pysetup/.venv/lib/python3.12/site-packages/django/core/handlers/asgi.py", line 170, in __call__
await self.handle(scope, receive, send)
File "/opt/pysetup/.venv/lib/python3.12/site-packages/django/core/handlers/asgi.py", line 216, in handle
task.result()
File "/opt/pysetup/.venv/lib/python3.12/site-packages/django/core/handlers/asgi.py", line 195, in process_request
await self.send_response(response, send)
File "/opt/pysetup/.venv/lib/python3.12/site-packages/django/core/handlers/asgi.py", line 357, in send_response
await send(
File "/opt/pysetup/.venv/lib/python3.12/site-packages/uvicorn/protocols/http/httptools_impl.py", line 526, in send
raise RuntimeError("Response content longer than Content-Length")
RuntimeError: Response content longer than Content-Length
The text was updated successfully, but these errors were encountered:
It seems this is not a problem with Uvicorn. It looks more like Daphne is not so strict (for better or worse). So the question is more why the Content-Length is wrong in the first place. Must it be set at all by the ProxyView?
medihack
changed the title
RuntimeError when with Uvicorn
RuntimeError when with Uvicorn (invalid Content-Length)
Jun 1, 2024
medihack
changed the title
RuntimeError when with Uvicorn (invalid Content-Length)
RuntimeError with Uvicorn (invalid Content-Length)
Jun 1, 2024
Thanks for posting the issue. There is an open issue, #122, asking for asgi support. I would like to dedicate some time to implement async await in django-revproxy... I'll try to find a spot in the near future...
When using
django-revproxy
with Uvicorn I get the below RuntimeError when trying to access a view inheriting fromProxyView
. This is not the case when using Daphne as a server. Uvicorn seems to be very strict withContent-Length
. Is there a workaround?The text was updated successfully, but these errors were encountered: