Skip to content

Trusted Proxy Issue when using reverse proxy #86844

Description

@DarrellVS

The problem

Hey, i've been using docker as OS for a little while on my RPI, but wanted to migrate to the container installation.
I've successfully installed the homeassistant and nginxreverseproxy images on my docker installation, but i'm getting some 'Login attempt or request with invalid authentication from [xxx]' errors, even when websockets are enabled in my nginx config.

I have added the http integration to allow the trusted proxies, and made sure they are using the same docker network but am still getting this error (added below). Any ideas?

I have cleared my browser data before logging in again, so it cannot be an invalid token.

This all is on a clean install of raspbian lite using the latest version of docker, docker compose, homeassistant and nginxreverseproxy.

I have both homeassistant and nginxreverseproxy running in a separate docker-compose file, with shared networks. I have added the docker-compose files below.

What version of Home Assistant Core has the issue?

core-2023.1.6

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant Container

Integration causing the issue

No response

Link to integration documentation on our website

No response

Diagnostics information

Homeassistant log file entry:

2023-01-21 19:26:35.409 WARNING (MainThread) [homeassistant.components.http.ban] Login attempt or request with invalid authentication from 192.168.178.28 (192.168.178.28). Requested URL: '/api/websocket'. (Mozilla/5.0 (Windows NT 6.2; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) QtWebEngine/6.3.1 Chrome/94.0.4606.126 Safari/537.36)

Example YAML snippet

HomeAssistant docker-compose.yml:

version: '3'
services:
  homeassistant:
    container_name: homeassistant
    image: "ghcr.io/home-assistant/home-assistant:stable"
    volumes:
      - /home/pi/homeassistant:/config
      - /etc/localtime:/etc/localtime:ro
    restart: unless-stopped
    privileged: true
#    network_mode: host
    ports:
      - '8123:8123'

networks:
  default:
    external: true
    name: proxynet

Anything in the logs that might be useful for us?

nginxproxymanager docker-compose.yml:

version: '3'
services:
  app:
    image: 'jc21/nginx-proxy-manager:latest'
    restart: unless-stopped
    ports:
      - '80:80'
      - '81:81'
      - '443:443'
    volumes:
      - ./data:/data
      - ./letsencrypt:/etc/letsencrypt

networks:
  default:
    external: true
    name: proxynet

Additional information

configuration.yaml


# Loads default set of integrations. Do not remove.
default_config:
  whitelist_external_dirs:
    - '/config/www'

http:
  use_x_forwarded_for: true
  trusted_proxies: 
    - 172.21.0.1
    - 172.20.0.2
    - 172.71.98.20

# Load frontend themes from the themes folder
frontend:
  themes: !include_dir_merge_named themes

# Text to speech
tts:
  - platform: google_translate

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions