[Bug]: Authentication behind swag (NGINX) reverse proxy unknown error in 15.0 Beta 2 #15377
-
        Checklist
 Describe the problem you are havingAfter updating to 0.15.0 Beta 2 I noticed that intermittenly, authentication will not work when accessing frigate via SWAG (also tried directly on port 8971, same result): Logs show: Digging into the source code of auth.py, I think this might be this line: it looks like sometimes the remote_addr attribute is no in the request object. I cannot work out why, sometimes it works and will then be ok for a few days, then it will stop working again. Might be as easy as adding a check for presence of the attribute. I have the same issue in Chrome, Firefox and Chrome on my mobile (Android). Steps to reproduce
 Version0.15.0-e76f4e9 In which browser(s) are you experiencing the issue with?No response Frigate config file# logger:
#   default: info
#   logs:
#     go2rtc: debug
auth:
  failed_login_rate_limit: 1/second;5/minute;20/hour
  trusted_proxies:
    - <REDACTED>
mqtt:
  # Optional: Enable mqtt server (default: shown below)
  enabled: true
  host: <REDACTED>
  port: 1883
  topic_prefix: frigate
  client_id: frigate
  user: '{FRIGATE_MQTT_USER}'
  password: '{FRIGATE_MQTT_PASSWORD}'
semantic_search:
  enabled: True
  reindex: False
  model_size: large
genai:
  enabled: True
  provider: gemini
  api_key: "<REDACTED>"
  model: gemini-1.5-flash
record:
  enabled: true
  expire_interval: 30
  retain:
    days: 7
    mode: all
  alerts:
    retain:
      days: 20
    pre_capture: 10
    post_capture: 10
  detections:
    retain:
      days: 20
    pre_capture: 10
    post_capture: 10
detectors:
  coral:
    type: edgetpu
    device: usb
#   tensorrt:
#     type: tensorrt
#     device: 0
# model:
#   path: /config/model_cache/tensorrt/yolov7-tiny-416.trt
#   input_tensor: nchw
#   input_pixel_format: rgb
#   width: 416
#   height: 416
birdseye:
  enabled: false
  mode: objects
ffmpeg:
  global_args: -hide_banner -loglevel warning -threads 4
  hwaccel_args: preset-nvidia-h265
  input_args: preset-rtsp-restream # check if udp can be used with cameras, may improve performance.
  output_args:
    # record: preset-record-generic-audio-copy
    record: preset-record-generic-audio-aac
go2rtc:
  log:
    format: text
    level: debug
  streams:
    FoH:
      - rtsp://zman:{FRIGATE_RTSP_PASSWORD}@<REDACTED>:554#hardware=cuda
      - ffmpeg:FoH#audio=opus
    # FoH_sub: "ffmpeg:rtsp://zman:{FRIGATE_RTSP_PASSWORD}@<REDACTED>:554#video=h264/cuda#audio=copy#audio=opus#width=1280#hardware=cuda"
    #FoH_sub: "ffmpeg:FoH#video=h264/cuda#audio=copy#audio=opus#width=1280#hardware=cuda"
    Back_Garden:
      - rtsp://zman:{FRIGATE_RTSP_PASSWORD}@<REDACTED>:554#hardware=cuda
      - ffmpeg:Back_Garden#audio=opus
    #Back_Garden_sub: "ffmpeg:Back_Garden#video=h264/cuda#audio=copy#audio=opus#width=1280#hardware=cuda"
    Doorbell: 
      ffmpeg:http://<REDACTED>/flv?port=1935&app=bcs&stream=channel0_main.bcs&user=frigate&password={FRIGATE_RTSP_PASSWORD}#video=copy#audio=copy#audio=opus
    # Doorbell: "ffmpeg:rtsp://frigate:{FRIGATE_RTSP_PASSWORD}@<REDACTED>:554#video=copy#audio=copy#audio=opus#hardware=cuda"
  webrtc:
    candidates:
      - <REDACTED>:8555
      - <REDACTED>:8555
      - stun:8555
cameras:
  # test:
  #   ffmpeg:
  #     inputs:
  #       - path: /media/frigate/exports/test_walking.mp4
  #         input_args: -re -stream_loop -1 -fflags +genpts
  #         roles:
  #           - detect
  #   detect:
  #     enabled: true # <---- disable detection until you have a working camera feed
  #     fps: 5
  #     width: 1280
  #     height: 720
  #   objects:
  #     track:
  #       - person
  #       - dog
  #       - bicycle
  #       # - car
  #     # - motorcycle
  #     # - suitcase
  #     # - skateboard
  #     # FOR 720-RES STREAM!!!
  #     filters:
  #       person:
  #         # Optional: minimum width*height of the bounding box for the detected object (default: 0)
  #         min_area: 2500
  #       cat:
  #         max_area: 25000
  #         mask: 
  #           0.924,1,0.848,0.657,0.942,0.515,0.812,0.305,0.719,0.358,0.512,0.402,0.477,0.395,0.395,0.132,0.198,0.142,0.039,0.251,0,1
  #       #car:
  #        # mask:
  #        # - 0,720,1280,720,1280,263,972,58,205,27,244,72,92,126
  #         #- 114,0,205,27,239,86,0,79,0,24
  #   motion:
  #     # threshold: 30
  #     # contour_area: 15
  #     mask:
  #       - 0,0.109,0.122,0.112,0.19,0.108,0.094,0.869,0,0.838
  #       - 0.478,0.411,0.613,0.376,0.737,0.373,0.788,0.351,0.921,0.555,0.954,0.456,0.9,0.281,0.833,0.294,0.759,0.313,0.701,0.255,0.574,0.282,0.503,0.196,0.448,0.273
  #       - 1,0.358,1,0,0.761,0,0.802,0.112
  #   zones:
  #     drive:
  #       coordinates: 0.099,0.7,0.392,0.733,0.437,0.399,0.453,0.406,0.377,0.181,0.177,0.167
  #       inertia: 3
  #       # List of objects that can trigger this zone 
  #       objects:
  #         - person
  #         - dog
  #       loitering_time: 0
  #     leighs_path:
  #       coordinates: 
  #         0.687,0.149,0.953,0.465,0.919,0.562,0.843,0.775,0.901,1,0.999,1,0.999,0.804,0.999,0.396,0.764,0.089,0.742,0.086,0.705,0.111
  #       inertia: 3
  #       # List of objects that can trigger this zone 
  #       loitering_time: 0
  #       objects:
  #         - bicycle
  #         - dog
  #         - person
  #     bins:
  #       coordinates: 
  #         0.47,0.649,0.426,0.914,0.468,0.958,0.6,0.959,0.61,1,0.902,1,0.834,0.744,0.874,0.643,0.922,0.553,0.799,0.352,0.438,0.41
  #       inertia: 3
  #       # List of objects that can trigger this zone 
  #       objects:
  #         - person
  #         - dog
  #       loitering_time: 0
  #     drive_steps:
  #       coordinates: 0.605,1,0.595,0.964,0.423,0.927,0.395,0.734,0.102,0.702,0.096,0.883,0,0.846,0,1
  #       inertia: 3
  #       # List of objects that can trigger this zone 
  #       loitering_time: 0
  #       objects:
  #         - dog
  #         - person
  #     road:
  #       coordinates: 
  #         0.762,0.085,0.822,0.153,0.824,0.125,0.786,0.054,0.745,0,0,0,0,0.12,0.19,0.12,0.192,0.162,0.372,0.18,0.38,0.113,0.435,0.118,0.444,0.067,0.715,0.11
  #       inertia: 3
  #       # List of objects that can trigger this zone 
  #       loitering_time: 0
  #       objects:
  #         - dog
  #         - person
  #         - bicycle
  #     Down_the_Street:
  #       coordinates: 0.762,0,1,0,1,0.391,0.78,0.107,0.702,0
  #       loitering_time: 3
  #       objects:
  #         - dog
  #         - person
  #       inertia: 3
  #   review:
  #     alerts:
  #       required_zones:
  #         - bins
  #         - drive
  #         - drive_steps
  #         - leighs_path
  Doorbell:
    enabled: true
    webui_url: https://<REDACTED>/
    ui:
      order: 1
    ffmpeg:
      inputs:
        - path: rtsp://127.0.0.1:8554/Doorbell
          roles:
            - record
            - audio
            - detect
    record: # <----- Enable recording
      enabled: true
    audio:
      enabled: true
    detect:
      enabled: true
      fps: 5
      width: 960
      height: 720
    snapshots: # <----- Enable snapshots
      enabled: true
    objects:
      track:
        - person
        - cat
        - dog
        - bird
        - bicycle
      filters:
        person:
          # Optional: minimum width*height of the bounding box for the detected object (default: 0)
          min_area: 2500
      # - car
      # - motorcycle
      # - suitcase
      # - skateboard
        cat:
          mask:
            - 0,720,341,720
    motion:
      # # FOR 720-RES Stream!!!
      mask:
        - 456,374,648,407,563,288,595,223,702,160,809,180,840,347,760,390,838,444,895,388,920,450,798,528,606,533,450,443
        - 0,720,0,390,339,430,335,720
        - 0,0,960,0,960,314,852,329,726,279,567,336,484,362,0,341
    zones:
      front_path:
        coordinates: 791,539,960,645,960,720,478,720,408,477,449,460
        inertia: 3
        # List of objects that can trigger this zone 
        # objects:
        #   - person
        #   - cat
        #   - dog
      kitchen_window:
        coordinates: 960,594,960,429,801,573
        inertia: 3
        # List of objects that can trigger this zone 
        # objects:
        #   - person
        #   - dog
      road:
        coordinates: 49,398,532,383,515,364,0,378
      next_door:
        coordinates: 0,720,302,720,332,434,0,398
        inertia: 3
        # List of objects that can trigger this zone 
        # objects:
        #   - person
        #   - dog
      drive:
        coordinates: 629,434,960,451,928,377,761,381,674,408
        inertia: 3
        # List of objects that can trigger this zone 
        # objects:
        #   - person
        #   - dog
    review:
      alerts:
        required_zones:
          - drive
          - front_path
          - kitchen_window
  Front_of_House: # <------ Name the camera
    enabled: true
    webui_url: https://<REDACTED>/
    ui:
      order: 2
    live:
      # stream_name: FoH_sub
      stream_name: FoH
    ffmpeg:
      inputs:
        - path: rtsp://127.0.0.1:8554/FoH
          roles:
            - record
            - audio
            - detect
      hwaccel_args: preset-nvidia-h265
    record: # <----- Enable recording
      enabled: true
    audio:
      enabled: true
    detect:
      enabled: true # <---- disable detection until you have a working camera feed
      fps: 5
      width: 1280
      height: 720
    snapshots: # <----- Enable snapshots
      enabled: true
    objects:
      track:
        - person
        - dog
        - bicycle
        # - car
      # - motorcycle
      # - suitcase
      # - skateboard
      # FOR 720-RES STREAM!!!
      filters:
        person:
          # Optional: minimum width*height of the bounding box for the detected object (default: 0)
          min_area: 2500
        cat:
          max_area: 25000
          mask: 
            0.924,1,0.848,0.657,0.942,0.515,0.812,0.305,0.719,0.358,0.512,0.402,0.477,0.395,0.395,0.132,0.198,0.142,0.039,0.251,0,1
        #car:
         # mask:
         # - 0,720,1280,720,1280,263,972,58,205,27,244,72,92,126
          #- 114,0,205,27,239,86,0,79,0,24
    motion:
      # threshold: 30
      # contour_area: 15
      mask:
        - 0,0.109,0.122,0.112,0.19,0.108,0.094,0.869,0,0.838
        - 0.478,0.411,0.613,0.376,0.737,0.373,0.788,0.351,0.921,0.555,0.954,0.456,0.9,0.281,0.833,0.294,0.759,0.313,0.701,0.255,0.574,0.282,0.503,0.196,0.448,0.273
        - 1,0.358,1,0,0.761,0,0.802,0.112
    zones:
      drive:
        coordinates: 0.099,0.7,0.392,0.733,0.437,0.399,0.453,0.406,0.377,0.181,0.177,0.167
        inertia: 3
        # List of objects that can trigger this zone 
        objects:
          - person
          - dog
        loitering_time: 0
      leighs_path:
        coordinates: 
          0.687,0.149,0.953,0.465,0.919,0.562,0.843,0.775,0.901,1,0.999,1,0.999,0.804,0.999,0.396,0.764,0.089,0.742,0.086,0.705,0.111
        inertia: 3
        # List of objects that can trigger this zone 
        loitering_time: 0
        objects:
          - bicycle
          - dog
          - person
      bins:
        coordinates: 
          0.47,0.649,0.426,0.914,0.468,0.958,0.6,0.959,0.61,1,0.902,1,0.834,0.744,0.874,0.643,0.922,0.553,0.799,0.352,0.438,0.41
        inertia: 3
        # List of objects that can trigger this zone 
        objects:
          - person
          - dog
        loitering_time: 0
      drive_steps:
        coordinates: 0.605,1,0.595,0.964,0.423,0.927,0.395,0.734,0.102,0.702,0.096,0.883,0,0.846,0,1
        inertia: 3
        # List of objects that can trigger this zone 
        loitering_time: 0
        objects:
          - dog
          - person
      road:
        coordinates: 
          0.762,0.085,0.822,0.153,0.824,0.125,0.786,0.054,0.745,0,0,0,0,0.12,0.19,0.12,0.192,0.162,0.372,0.18,0.38,0.113,0.435,0.118,0.444,0.067,0.715,0.11
        inertia: 3
        # List of objects that can trigger this zone 
        loitering_time: 0
        objects:
          - dog
          - person
          - bicycle
      Down_the_Street:
        coordinates: 0.762,0,1,0,1,0.391,0.78,0.107,0.702,0
        loitering_time: 3
        objects:
          - dog
          - person
        inertia: 3
    review:
      alerts:
        required_zones:
          - bins
          - drive
          - drive_steps
          - leighs_path
  Back_Garden: # <------ Name the camera
    enabled: true
    webui_url: https://<REDACTED>/
    ui:
      order: 3
    live:
      # stream_name: Back_Garden_sub
      stream_name: Back_Garden
    ffmpeg:
      inputs:
        - path: rtsp://127.0.0.1:8554/Back_Garden
          roles:
            - record
            - audio
            - detect
      hwaccel_args: preset-nvidia-h265
    record: # <----- Enable recording
      enabled: true
    audio:
      enabled: true
      listen:
        - bark
        - fire_alarm
        - scream
        - yell
    detect:
      enabled: true # <---- disable detection until you have a working camera feed
      fps: 5
      width: 1280
      height: 720
    snapshots: # <----- Enable snapshots
      enabled: true
    objects:
      track:
        - person
        - cat
        - dog
      filters:
        person:
          mask: 0.07,0.348,0.153,0.279,0.181,0.414,0.094,0.488
    zones:
      lower_patio:
        coordinates: 0.041,0.395,0.333,0.285,0.436,0.359,0.192,0.668,0.199,0.7,0.105,0.786
        inertia: 3
        loitering_time: 0
      living_room_window:
        coordinates: 0.341,1,0,1,0.034,0.436,0.105,0.765,0.198,0.694
        inertia: 3
        loitering_time: 0
      flower_bed:
        coordinates: 0.449,1,0.91,1,0.976,0.368,0.599,0.224,0.226,0.648
        inertia: 3
        loitering_time: 0
      shed:
        coordinates: 0.569,0.14,0.576,0,0.423,0,0.398,0.144,0.423,0.186
        inertia: 3
        loitering_time: 0
      top_patio:
        coordinates: 0.569,0.23,0.949,0.344,0.956,0.051,0.577,0,0.556,0.152,0.419,0.191
        inertia: 3
        loitering_time: 0
      nans_fence:
        coordinates: 1,1,0.914,1,0.964,0.362,0.96,0.079,1,0.082
        inertia: 3
        loitering_time: 0
      leighs_fence:
        coordinates: 0.032,0.285,0.153,0.194,0.435,0.056,0.415,0,0.029,0
        inertia: 3
        loitering_time: 0
      Patio_Steps:
        coordinates: 0.419,0.185,0.558,0.23,0.451,0.351,0.32,0.27
        loitering_time: 0
    motion:
      mask:
        - 0.408,0.05,0.457,0.056,0.557,0.045,0.584,0,0,0,0,0.156,0.035,0.223,0.08,0.205,0.082,0.122,0.131,0.109,0.2,0.158
        - 0.693,0.117,0.753,0.356,0.451,0.836,0.671,1,0.934,1,0.983,0.327,0.965,0.105,1,0.106,1,0,0.58,0,0.59,0.09
        - 0.232,0.67,0.545,0.249,0.624,0.242,0.682,0.272,0.715,0.365,0.334,0.854,0.236,0.729
    review:
      alerts:
        required_zones:
          - lower_patio
          - shed
          - top_patio
version: 0.15-0
camera_groups:
  Front:
    order: 1
    icon: LuCar
    cameras:
      - Doorbell
      - Front_of_Housedocker-compose file or Docker CLI commandNoneRelevant Frigate log output2024-12-06 15:31:29.687044195      await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
2024-12-06 15:31:29.687046006    File "/usr/local/lib/python3.9/dist-packages/starlette/_exception_handler.py", line 53, in wrapped_app
2024-12-06 15:31:29.687047376      raise exc
2024-12-06 15:31:29.687049013    File "/usr/local/lib/python3.9/dist-packages/starlette/_exception_handler.py", line 42, in wrapped_app
2024-12-06 15:31:29.687050486      await app(scope, receive, sender)
2024-12-06 15:31:29.687052292    File "/usr/local/lib/python3.9/dist-packages/starlette/routing.py", line 715, in __call__
2024-12-06 15:31:29.687053835      await self.middleware_stack(scope, receive, send)
2024-12-06 15:31:29.687055582    File "/usr/local/lib/python3.9/dist-packages/starlette/routing.py", line 735, in app
2024-12-06 15:31:29.687057053      await route.handle(scope, receive, send)
2024-12-06 15:31:29.687058803    File "/usr/local/lib/python3.9/dist-packages/starlette/routing.py", line 288, in handle
2024-12-06 15:31:29.687060364      await self.app(scope, receive, send)
2024-12-06 15:31:29.687062187    File "/usr/local/lib/python3.9/dist-packages/starlette/routing.py", line 76, in app
2024-12-06 15:31:29.687063862      await wrap_app_handling_exceptions(app, request)(scope, receive, send)
2024-12-06 15:31:29.687065617    File "/usr/local/lib/python3.9/dist-packages/starlette/_exception_handler.py", line 53, in wrapped_app
2024-12-06 15:31:29.687067121      raise exc
2024-12-06 15:31:29.687068799    File "/usr/local/lib/python3.9/dist-packages/starlette/_exception_handler.py", line 42, in wrapped_app
2024-12-06 15:31:29.687070157      await app(scope, receive, sender)
2024-12-06 15:31:29.687071879    File "/usr/local/lib/python3.9/dist-packages/starlette/routing.py", line 73, in app
2024-12-06 15:31:29.687073327      response = await f(request)
2024-12-06 15:31:29.687074941    File "/usr/local/lib/python3.9/dist-packages/fastapi/routing.py", line 301, in app
2024-12-06 15:31:29.687076436      raw_response = await run_endpoint_function(
2024-12-06 15:31:29.687078173    File "/usr/local/lib/python3.9/dist-packages/fastapi/routing.py", line 214, in run_endpoint_function
2024-12-06 15:31:29.687079639      return await run_in_threadpool(dependant.call, **values)
2024-12-06 15:31:29.687081409    File "/usr/local/lib/python3.9/dist-packages/starlette/concurrency.py", line 39, in run_in_threadpool
2024-12-06 15:31:29.687083016      return await anyio.to_thread.run_sync(func, *args)
2024-12-06 15:31:29.687084678    File "/usr/local/lib/python3.9/dist-packages/anyio/to_thread.py", line 56, in run_sync
2024-12-06 15:31:29.687086218      return await get_async_backend().run_sync_in_worker_thread(
2024-12-06 15:31:29.687088055    File "/usr/local/lib/python3.9/dist-packages/anyio/_backends/_asyncio.py", line 2441, in run_sync_in_worker_thread
2024-12-06 15:31:29.687089270      return await future
2024-12-06 15:31:29.687090894    File "/usr/local/lib/python3.9/dist-packages/anyio/_backends/_asyncio.py", line 943, in run
2024-12-06 15:31:29.687092171      result = context.run(func, *args)
2024-12-06 15:31:29.687093799    File "/usr/local/lib/python3.9/dist-packages/slowapi/extension.py", line 764, in sync_wrapper
2024-12-06 15:31:29.687095430      self._check_request_limit(request, func, False)
2024-12-06 15:31:29.687097507    File "/usr/local/lib/python3.9/dist-packages/slowapi/extension.py", line 630, in _check_request_limit
2024-12-06 15:31:29.687099155      self.__evaluate_limits(request, _endpoint_key, all_limits)
2024-12-06 15:31:29.687101133    File "/usr/local/lib/python3.9/dist-packages/slowapi/extension.py", line 497, in __evaluate_limits
2024-12-06 15:31:29.687102705      limit_key = lim.key_func(request)
2024-12-06 15:31:29.687104245    File "/opt/frigate/frigate/api/auth.py", line 88, in get_remote_addr
2024-12-06 15:31:29.687105659      return request.remote_addr or "127.0.0.1"
2024-12-06 15:31:29.687107122  AttributeError: 'Request' object has no attribute 'remote_addr'Relevant go2rtc log outputNoneOperating systemUNRAID Install methodDocker CLI Network connectionWired Camera make and modelVarious Reolink Screenshots of the Frigate UI's System metrics pagesAny other information that may be helpfulNo response  | 
  
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
| 
         Thanks, fixed in #15378  | 
  
Beta Was this translation helpful? Give feedback.





Thanks, fixed in #15378