{"id":21325,"library":"fastapi-proxy-lib","title":"fastapi-proxy-lib","description":"HTTP/WebSocket proxy middleware for Starlette/FastAPI, version 0.3.0, allowing you to add a reverse proxy endpoint with minimal code. Released as needed.","status":"active","version":"0.3.0","language":"python","source_language":"en","source_url":"https://github.com/mcomt/fastapi-proxy-lib","tags":["fastapi","proxy","reverse-proxy","http-proxy","websocket"],"install":[{"cmd":"pip install fastapi-proxy-lib","lang":"bash","label":"standard install"}],"dependencies":[{"reason":"required for the base ASGI framework","package":"starlette","optional":false},{"reason":"used to forward client requests","package":"httpx","optional":false}],"imports":[{"note":"old import path in early versions, no longer works","wrong":"from fastapi_proxy_lib.app import add_route_proxy","symbol":"add_route_proxy","correct":"from fastapi_proxy_lib import add_route_proxy"},{"note":"common mistake; reverse_proxy is a top-level function","wrong":"from fastapi_proxy_lib.router import reverse_proxy","symbol":"reverse_proxy","correct":"from fastapi_proxy_lib import reverse_proxy"}],"quickstart":{"code":"from fastapi import FastAPI\nfrom fastapi_proxy_lib import reverse_proxy\n\napp = FastAPI()\n\n@app.get('/proxy/{path:path}')\nasync def proxy(path: str):\n    target = f'https://httpbin.org/{path}'\n    return await reverse_proxy(target)\n\n# run with: uvicorn main:app --reload","lang":"python","description":"Creates a FastAPI app with a catch-all proxy endpoint that forwards requests to httpbin."},"warnings":[{"fix":"Update to `await reverse_proxy('https://target.com/path')` instead of `await reverse_proxy(request, url='https://target.com/path')`.","message":"In 0.3.0, the signature of `reverse_proxy` changed; the first argument is now a URL string instead of a request object. Old code will raise TypeError.","severity":"breaking","affected_versions":">=0.3.0"},{"fix":"Always provide a fully qualified URL (including scheme and host) to `reverse_proxy`.","message":"The `reverse_proxy` function expects an absolute URL. Relative paths will cause an httpx.InvalidURL exception.","severity":"gotcha","affected_versions":"all"},{"fix":"Replace `add_route_proxy(app, ...)` with a custom route that calls `reverse_proxy`.","message":"The `add_route_proxy` function was deprecated in 0.3.0 in favor of `reverse_proxy`. It will be removed in a future version.","severity":"deprecated","affected_versions":"0.3.0"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Call `reverse_proxy('https://example.com/path')` with a string URL.","cause":"Old usage passing a request object instead of a URL string.","error":"TypeError: reverse_proxy() missing 1 required positional argument: 'url'"},{"fix":"Provide an absolute URL including scheme and host, e.g., 'https://api.example.com/api'.","cause":"Relative URL passed to reverse_proxy.","error":"httpx.InvalidURL: Invalid URL: '/api'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}