From bf0d985b9d6284c4f088b00e090392c3b0d4c2c5 Mon Sep 17 00:00:00 2001 From: ZhaiSoul <842607283@qq.com> Date: Thu, 5 Feb 2026 15:38:30 +0000 Subject: [PATCH] fix: fix where go2rtc functionality becomes unavailable after setting the HTTP_PROXY environment variable. --- frigate/api/camera.py | 9 +++++++-- frigate/util/services.py | 6 +++++- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/frigate/api/camera.py b/frigate/api/camera.py index 488ec1e1f..3553bcc16 100644 --- a/frigate/api/camera.py +++ b/frigate/api/camera.py @@ -56,7 +56,9 @@ def _is_valid_host(host: str) -> bool: @router.get("/go2rtc/streams", dependencies=[Depends(allow_any_authenticated())]) def go2rtc_streams(): - r = requests.get("http://127.0.0.1:1984/api/streams") + r = requests.get( + "http://127.0.0.1:1984/api/streams", proxies={"http": None, "https": None} + ) if not r.ok: logger.error("Failed to fetch streams from go2rtc") return JSONResponse( @@ -75,7 +77,8 @@ def go2rtc_streams(): ) def go2rtc_camera_stream(request: Request, camera_name: str): r = requests.get( - f"http://127.0.0.1:1984/api/streams?src={camera_name}&video=all&audio=allµphone" + f"http://127.0.0.1:1984/api/streams?src={camera_name}&video=all&audio=allµphone", + proxies={"http": None, "https": None}, ) if not r.ok: camera_config = request.app.frigate_config.cameras.get(camera_name) @@ -107,6 +110,7 @@ def go2rtc_add_stream(request: Request, stream_name: str, src: str = ""): "http://127.0.0.1:1984/api/streams", params=params, timeout=10, + proxies={"http": None, "https": None}, ) if not r.ok: logger.error(f"Failed to add go2rtc stream {stream_name}: {r.text}") @@ -142,6 +146,7 @@ def go2rtc_delete_stream(stream_name: str): "http://127.0.0.1:1984/api/streams", params={"src": stream_name}, timeout=10, + proxies={"http": None, "https": None}, ) if not r.ok: logger.error(f"Failed to delete go2rtc stream {stream_name}: {r.text}") diff --git a/frigate/util/services.py b/frigate/util/services.py index 64d83833d..4f6961371 100644 --- a/frigate/util/services.py +++ b/frigate/util/services.py @@ -629,7 +629,11 @@ def auto_detect_hwaccel() -> str: try: cuda = False vaapi = False - resp = requests.get("http://127.0.0.1:1984/api/ffmpeg/hardware", timeout=3) + resp = requests.get( + "http://127.0.0.1:1984/api/ffmpeg/hardware", + timeout=3, + proxies={"http": None, "https": None}, + ) if resp.status_code == 200: data: dict[str, list[dict[str, str]]] = resp.json()