Skip to content

iOS widgets only work using a local URL and yield a Failed to fetch states on server in the logs otherwise #3777

@Ecco

Description

@Ecco

I'm using a self-hosted HomeAssistant instance behind an nginx reverse-proxy. Per #3575 this is a supported configuration: nginx doesn't do any secondary authentication or any weird access restriction. It really just terminates the TLS connection (using a real certificate from Let's Encrypt) and forwards it to HomeAssistant.

And the whole thig works really well, either using a browse or the companion app (on iPhone and iPad).

However, for some reason, there's a weird connectivity bug that I can't fix : iOS widgets don't work at all.

Here's what's super weird: if I bypass the nginx proxy entirely and connect directly to the local homeassistant instance (e.g. instead of https://my-hass.duckdns.org I will use http://homeassistant.local:8123), then the widgets work perfectly.

But if I use the public address, then everything keeps on working well, except the iOS widgets that will not work anymore. In the companion app I can see an error The operation couldn’t be completed. (HAKit.HADataError error 2.). And downloading the full logs showed this message:

[Error] [main] [AppDatabaseUpdater.swift:61] updateEntitiesDatabase(server:) > Failed to fetch states: underlying(HAKit.HADataError.couldntTransform(key: "root"))

I've been trying to diagnose what's going on, and I'm out of luck. I've played with mitmproxy all day and as far as I can tell the home assistant server receives pretty much the same requests whether it goes through nginx or if the client connects directly. And yet, the widgets only ever update using the local URL… What's super weird is that the rest of the companion app works perfectly in either scenario.

Key Value
Model Name iPhone 12 Mini
iOS Version iOS 18.1.1
Companion App version 2025.7.2
Server Home Assistant version 2025.8.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions