skrashevich/double-take

[BUG] 1.13.11.9rc1 'X-Forwarded-For' header error

townsmcp opened this issue · 1 comments

Describe the bug
I have just installed the latest RC. When I look at the logs I see the error message (at the bottom) but after the error I see 23-12-23 14:01:59 info: Access granted to IP address: ::ffff:172.30.32.2 so not sure if this is working ok? No motion on the cameras yet to send from Frigate to DT. I have been running Frigate 0.13.0-C35C7DA for a few weeks without issues to DT. Upgraded DT from 1.13.11.8.

Version of Double Take
1.13.11.9rc1
Version of Frigate - 0.13.0-C35C7DA.
HA:
Core 2023.12.3
Supervisor 2023.12.0
Operating System 11.2
Frontend 20231208.2

Expected behavior
Logs to not show this error

Screenshots
If applicable, add screenshots to help explain your problem.

Configuration
You configuration files, related to problem. The config is a bit messy from where I have been playing with settings recently, which included a potential workaround to get MQTT into the previous DT install, however:

# Double Take
# Learn more at https://github.com/jakowenko/double-take/#configuration
# "Snapshot" -- frame from frigate, saved then frigate detect an event (motion, for example)
# "Latest" -- frame from camera, on the moment then double-take trying to make an recognition (Usually, the difference between them is 1-2 seconds)
# "MQTT" -- The frame that the frigate transmitted with the event by MQTT protocol. It's usually equivalent to "snapshot", but depends on frigate settings

# The current crazy zoo of methods is due to historical reasons. If u use double-take in conjunction with frigate, the "snapshot" method will be enough

# JT - want either MQTT or Snapshot. MQTT does not include zone

# Deepstack - face: https://github.com/robmarkcole/HASS-Deepstack-face
# Deepstack - object: https://github.com/robmarkcole/HASS-Deepstack-object/blob/master/README.md

# https://community.home-assistant.io/t/facial-recognition-room-presence-using-double-take-frigate/290943/112
ui:
  pagination:
    # number of results per page
    limit: 28

  thumbnails:
    # value between 0-100
    quality: 95
    # value in pixels
    width: 500

home_assistant:
  url: http://192.168.1.198:8123
  token: XXXX
  
# time settings (default: shown below)
time:
  # defaults to iso 8601 format with support for token-based formatting
  # https://github.com/moment/luxon/blob/master/docs/formatting.md#table-of-tokens
 # format: dtt
  # time zone used in logs
  timezone: Europe/London

frigate:
  url: http://192.168.1.233:5000
  update_sub_labels: true
  # stop the processing loop if a match is found
  # if set to false all image attempts will be processed before determining the best match
  stop_on_match: true
  # ignore detected areas so small that face recognition would be difficult
  # quadrupling the min_area of the detector is a good start
  # does not apply to MQTT events
  min_area: 0 
  # ignore detected areas so small that face recognition would be difficult
  # quadrupling the min_area of the detector is a good start
  # does not apply to MQTT events
  #min_area: 1600
  # object labels that are allowed for facial recognition
  labels:
    - person
    - dog
    - cat
  zones:
    - camera: doorbell
      zone: garden_doorbell
    - camera: car-port
      zone: driveway_carport
  cameras:
    - doorbell
    - car-port

  # override frigate attempts and image per camera
  events:
    doorbell:
      attempts:
        # number of times double take will request a frigate latest.jpg for facial recognition
        latest: 10
        # number of times double take will request a frigate snapshot.jpg for facial recognition
        snapshot: 0
        # process frigate images from frigate/<camera-name>/person/snapshot topic
        mqtt: true
        # add a delay expressed in seconds between each detection loop
        delay: 1
      image:
        # height of frigate image passed for facial recognition (only if using default latest.jpg and snapshot.jpg)
        height: 1200
        # custom image that will be used in place of latest.jpg
        latest: http://192.168.1.173/snap.jpeg
        # custom image that will be used in place of snapshot.jpg
        # snapshot: http://192.168.1.173/snap.jpeg
    car-port:
      attempts:
        # number of times double take will request a frigate latest.jpg for facial recognition
        latest: 10
        # number of times double take will request a frigate snapshot.jpg for facial recognition
        snapshot: 0
        # process frigate images from frigate/<camera-name>/person/snapshot topic
        mqtt: true
        # add a delay expressed in seconds between each detection loop
        delay: 1
      image:
        # height of frigate image passed for facial recognition (only if using default latest.jpg and snapshot.jpg)
        height: 1512
        # custom image that will be used in place of latest.jpg
        latest: http://192.168.1.240/snap.jpeg
        # custom image that will be used in place of snapshot.jpg
        # snapshot: http://192.168.1.240/snap.jpeg
        
cameras:
  doorbell:
    mqtt:
      timestamp: False
      bounding_box: False
      crop: false
      quality: 100
      height: 1200
  car-port:
    mqtt:
      timestamp: False
      bounding_box: False
      crop: false
      quality: 100
      height: 1512
      
mqtt:
  host: 192.168.1.198
  username: mqtt-user
  password: XXX
  #client_id: double-take
  topics:
    # mqtt topic for frigate message subscription
    frigate: frigate/events
    #  mqtt topic for home assistant discovery subscription
    homeassistant: homeassistant
    # mqtt topic where matches are published by name
    matches: double-take/matches
    # mqtt topic where matches are published by camera name
    cameras: double-take/cameras
  
detectors:
    #If you want no match then increase det_prob_threshold: 80 a little at a time and re-test your matches… it will return nothing if it fails this test. I have been creeping this value up and it has really reduced the number of images accepted and false positives from blurry movement shots etc.
  compreface:
    url: http://192.168.1.233:8000
    # recognition api key
    key: XXX
    # number of seconds before the request times out and is aborted
    timeout: 15
    # minimum required confidence that a recognized face is actually a face
    # value is between 0.0 and 1.0
    det_prob_threshold: 0.8
    # det_prob_threshold: 0.98
    # require opencv to find a face before processing with detector
    opencv_face_required: false
    # comma-separated slugs of face plugins
    # https://github.com/exadel-inc/CompreFace/blob/master/docs/Face-services-and-plugins.md)
    # face_plugins: mask,gender,age
    # only process images from specific cameras, if omitted then all cameras will be processed
    # cameras:
    #   - front-door
    #   - garage

telemetry: false
detect:
  match:
    # save match images
    save: true
    # include base64 encoded string in api results and mqtt messages
    # options: true, false, box
    base64: false
    # minimum confidence needed to consider a result a match
    confidence: 85
    # hours to keep match images until they are deleted
    purge: 24
    # minimum area in pixels to consider a result a match
    # min_area: 2500
    min_area: 3500
    # min_area: 21000
    #when using substream image, 3600
  unknown:
    # save unknown images
    save: true
    # include base64 encoded string in api results and mqtt messages
    # options: true, false, box
    base64: false
    # minimum confidence needed before classifying a name as unknown
    confidence: 85
    # hours to keep unknown images until they are deleted
    purge: 24
    # minimum area in pixels to keep an unknown result
    min_area: 64

Additional context
Error displayed in the logs:

23-12-23 14:01:57 info: Access granted to IP address: ::ffff:172.30.32.2
23-12-23 14:01:57 error: ValidationError: The 'X-Forwarded-For' header is set but the Express 'trust proxy' setting is false (default). This could indicate a misconfiguration which would prevent express-rate-limit from accurately identifying users. See https://express-rate-limit.github.io/ERR_ERL_UNEXPECTED_X_FORWARDED_FOR/ for more information.
    at Object.xForwardedForHeader (/double-take/api/node_modules/express-rate-limit/dist/index.cjs:166:13)
    at wrappedValidations.<computed> [as xForwardedForHeader] (/double-take/api/node_modules/express-rate-limit/dist/index.cjs:324:22)
    at Object.keyGenerator (/double-take/api/node_modules/express-rate-limit/dist/index.cjs:579:20)
    at /double-take/api/node_modules/express-rate-limit/dist/index.cjs:629:32
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async /double-take/api/node_modules/express-rate-limit/dist/index.cjs:611:5
23-12-23 14:01:59 info: Access granted to IP address: ::ffff:172.30.32.2
23-12-23 14:01:59 info: Access granted to IP address: ::ffff:172.30.32.2

You can ignore this error. everything works fine

This error in the logs has already been fixed with e04c437 commit. you can install latest "beta" or wait for rc2/release