Alovestocode commited on
Commit
689867f
·
verified ·
1 Parent(s): 8bc1f92

Fix: Use pure ASGI middleware to avoid Content-Length issues

Browse files
Files changed (1) hide show
  1. app.py +1 -0
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...")