Spaces:
Running
on
Zero
Running
on
Zero
Fix: Use pure ASGI middleware to avoid Content-Length issues
Browse files
app.py
CHANGED
|
@@ -593,6 +593,7 @@ with gr.Blocks(
|
|
| 593 |
original_app = gradio_app.app
|
| 594 |
gradio_app.app = FastAPIRouteMiddleware(original_app)
|
| 595 |
print("FastAPI routes mounted successfully via pure ASGI middleware")
|
|
|
|
| 596 |
except Exception as middleware_error:
|
| 597 |
# Fallback: try to add routes directly to router
|
| 598 |
print(f"Middleware approach failed: {middleware_error}, trying direct route addition...")
|
|
|
|
| 593 |
original_app = gradio_app.app
|
| 594 |
gradio_app.app = FastAPIRouteMiddleware(original_app)
|
| 595 |
print("FastAPI routes mounted successfully via pure ASGI middleware")
|
| 596 |
+
# Pure ASGI middleware avoids Content-Length issues with BaseHTTPMiddleware
|
| 597 |
except Exception as middleware_error:
|
| 598 |
# Fallback: try to add routes directly to router
|
| 599 |
print(f"Middleware approach failed: {middleware_error}, trying direct route addition...")
|