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 | 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:
http:
use_x_forwarded_for: true
trusted_proxies:
- 127.0.0.1
ip_ban_enabled: true
login_attempts_threshold: 5
just below the default_config:
line, adding a newline in between. If your reverse proxy is running on another host, replace 127.0.0.1
by the IP address of that host.
Complete configuration.yml
example:
# 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
tts:
- platform: google_translate
group: !include groups.yaml
automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml
Now restart home-assistant and your reverse proxy should work fine.