Reverse Proxy on Qnap Nas - homeassistant.components.http.ban] Login attempt or request with invalid authentication

Hi together,

I`ve set up a reverse proxy on my Qnap Nas to access Home Assistant over internet. The https traffic on 443 is passed to local http://192.168.5.14:8123. Only port 443 is forwarded to the Nas.
Qnap DDNS service is used / SSL certificate is also available.

With this setup I can access the Home Assistant login page using my domain https://xxx.myqnapcloud.com. However, after entering Username/Password and 2FA information it says “Unable to connect to Home Assistant” Retry.

In the Home Assistant log file following occurs:
WARNING (MainThread) [homeassistant.components.http.ban] Login attempt or request with invalid authentication from external IP. (Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.110 Safari/537.36)

The following configuration is used: The most important is the http: section with use_x_forwarded_for for reverse proxy. But what else has to be configured?
Just to try out I added my external ip to the auth_providers trusted networks but the same situation after entering 2fa no access.

homeassistant:
  name: Home
  latitude: xx.7491
  longitude: x.2406
  unit_system: metric
  currency: EUR
  time_zone: Europe/xxx
  external_url: https://xxx.myqnapcloud.com
  internal_url: http://192.168.5.14:8123

  auth_providers:
    - type: trusted_networks
      trusted_networks:
        - 192.168.5.0/24
        - 127.0.0.1
        - ::1
    - type: homeassistant

http:
  use_x_forwarded_for: true
  trusted_proxies:
    - 127.0.0.1
    - 192.168.5.0/24
    - ::1
  
#  ip_ban_enabled: true
#  login_attempts_threshold: 5

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

I could find out the reverse proxy requires websocket support and I think the qnap implementation does not support it.
So I dropped the qnap reverse proxy and installed Nginx Proxy Manager with that it works fine!

Hey,

I‘m facing the same issue at the moment.

I would like to use the QNAP url also for HA. Do you use a different url or the myqnapcloud? If the latter one how did you set up the system?

Thanks.

The new version of QTS seems to support WebSocket; mind sharing more information on the setup?

1 Like

Thank you, this solve my issue with home assistant and qnap reverse proxy. Now all works fine and finally i don’t need to update ssl certificate every 3 months!

to do this you have to set http websocket protocol option in the destination rule of qnap reverse proxy

Could you post your docker run command or your docker-compose.yml please?