How to fix Home-Assistant A request from a reverse proxy was received from 127.0.0.1, but your HTTP integration is not set-up for reverse proxies

Problem:

When running home-assistant(using docker or other methods) behind a reverse proxy such as nginx, you see 400: Bad request response codes and the following error message appears in the HomeAssistant logs:

homeassistant_log_error.txt
homeassistant    | 2021-11-25 03:03:59 ERROR (MainThread) [homeassistant.components.http.forwarded] A request from a reverse proxy was received from 127.0.0.1, but your HTTP integration is not set-up for reverse proxies

Solution

Edit config/configuration.yaml and add:

configuration.yaml
http:
  use_x_forwarded_for: true
  trusted_proxies:
  - 127.0.0.1
  ip_ban_enabled: true
  login_attempts_threshold: 5

Complete configuration.yml example:

trusted_proxies:

configuration_full_example.yaml
# Configure a default setup of Home Assistant (frontend, api, etc)
default_config:

http:
  use_x_forwarded_for: true
  trusted_proxies:
  - 127.0.0.1
  ip_ban_enabled: true
  login_attempts_threshold: 5

# Text to speech
group: !include groups.yaml
  - platform: google_translate

group: !include groups.yaml
automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml

script: !include scripts.yaml scene: !include scenes.yaml

example.txt

Now **restart *home-assistant* and your reverse proxy should work fine.**

Check out similar posts by category: Home-Assistant