iOS Websocket frontend error, Starscream.HTTPUpgradeError.notAnUpgrade(400)

Hi,

I’ve just setup my HomeAssistant with my own domain name. I’ve set a CNAME (ha.domain.nl:8123) and that worked flawlessy when I’ve put in the portnumber for the dashboard behind it.

To make this easier I’ve put the NGINX reverse proxy manager behind it so I could reach my HomeAssistant by going to the domainname itself ha.homeassistant.nl. This all works nice on the computer but it’s giving me an error on the iOS application (see below).

Whenever I open the app and search for the HA sever on my domainname it will find it without any problem but if keeps connecting and after a minute or 3 it will throw the following error;

Starscream.HTTPUpgradeError 0

When I export the log it says the following;
(replaced my actual domainname with DOMAIN for obvious reasons).

2022-02-14 22:36:35.546 [Verbose] [main] [OnboardingAuthLogin.swift:21] open(authDetails:sender:) > https://DOMAIN/auth/authorize?response_type=code&client_id=https://home-assistant.io/iOS&redirect_uri=homeassistant://auth-callback
2022-02-14 22:36:45.097 [Info] [main] [OnboardingAuth.swift:153] configuredAPI(instance:code:) >
2022-02-14 22:36:45.121 [Verbose] [main] [OnboardingAuth.swift:161] configuredAPI(instance:code:) >
2022-02-14 22:36:45.122 [Info] [main] [OnboardingAuth.swift:95] performPostSteps(checkPoint:api:sender:) > beforeRegister
2022-02-14 22:36:45.124 [Info] [main] [Environment.swift:71] init() > WebSocket: connecting using HAConnectionInfo(url: https://DOMAIN, userAgent: Optional(“Home Assistant/2022.2 (io.robbie.HomeAssistant; build:2022.345; iOS 15.3.1)”), engine: nil)
2022-02-14 22:36:45.156 [Info] [main] [Environment.swift:71] init() > WebSocket: Viability changed: true
2022-02-14 22:36:45.168 [Error] [main] [Environment.swift:72] init() > WebSocket: Error: Optional(Starscream.HTTPUpgradeError.notAnUpgrade(400))
2022-02-14 22:36:45.168 [Info] [main] [Environment.swift:71] init() > WebSocket: phase transition to disconnected(error: Optional(Starscream.HTTPUpgradeError.notAnUpgrade(400)), forReset: false)
2022-02-14 22:36:45.168 [Info] [main] [Environment.swift:71] init() > WebSocket: disconnecting; permanently: false, error: Optional(Starscream.HTTPUpgradeError.notAnUpgrade(400))
2022-02-14 22:36:45.168 [Info] [main] [Environment.swift:71] init() > WebSocket: phase transition to disconnected(error: nil, forReset: true)
2022-02-14 22:36:45.169 [Info] [main] [Environment.swift:71] init() > WebSocket: connecting using HAConnectionInfo(url: https://DOMAIN, userAgent: Optional(“Home Assistant/2022.2 (io.robbie.HomeAssistant; build:2022.345; iOS 15.3.1)”), engine: nil)
2022-02-14 22:36:45.195 [Info] [main] [Environment.swift:71] init() > WebSocket: Viability changed: true
2022-02-14 22:36:45.209 [Error] [main] [Environment.swift:72] init() > WebSocket: Error: Optional(Starscream.HTTPUpgradeError.notAnUpgrade(400))
2022-02-14 22:36:45.209 [Info] [main] [Environment.swift:71] init() > WebSocket: phase transition to disconnected(error: Optional(Starscream.HTTPUpgradeError.notAnUpgrade(400)), forReset: false)
2022-02-14 22:36:45.209 [Info] [main] [Environment.swift:71] init() > WebSocket: disconnecting; permanently: false, error: Optional(Starscream.HTTPUpgradeError.notAnUpgrade(400))
2022-02-14 22:36:45.209 [Info] [main] [Environment.swift:71] init() > WebSocket: phase transition to disconnected(error: nil, forReset: true)
2022-02-14 22:36:50.211 [Info] [main] [Environment.swift:71] init() > WebSocket: connecting using HAConnectionInfo(url: https://DOMAIN, userAgent: Optional(“Home Assistant/2022.2 (io.robbie.HomeAssistant; build:2022.345; iOS 15.3.1)”), engine: nil)
2022-02-14 22:36:50.256 [Info] [main] [Environment.swift:71] init() > WebSocket: Viability changed: true
2022-02-14 22:36:50.270 [Error] [main] [Environment.swift:72] init() > WebSocket: Error: Optional(Starscream.HTTPUpgradeError.notAnUpgrade(400))
2022-02-14 22:36:50.270 [Info] [main] [Environment.swift:71] init() > WebSocket: phase transition to disconnected(error: Optional(Starscream.HTTPUpgradeError.notAnUpgrade(400)), forReset: false)
2022-02-14 22:36:50.270 [Info] [main] [Environment.swift:71] init() > WebSocket: disconnecting; permanently: false, error: Optional(Starscream.HTTPUpgradeError.notAnUpgrade(400))
2022-02-14 22:36:50.270 [Info] [main] [Environment.swift:71] init() > WebSocket: phase transition to disconnected(error: nil, forReset: true)
2022-02-14 22:36:59.115 [Info] [main] [Environment.swift:71] init() > WebSocket: connecting using HAConnectionInfo(url: https://DOMAIN, userAgent: Optional(“Home Assistant/2022.2 (io.robbie.HomeAssistant; build:2022.345; iOS 15.3.1)”), engine: nil)
2022-02-14 22:36:59.160 [Info] [main] [Environment.swift:71] init() > WebSocket: Viability changed: true
2022-02-14 22:36:59.172 [Error] [main] [Environment.swift:72] init() > WebSocket: Error: Optional(Starscream.HTTPUpgradeError.notAnUpgrade(400))
2022-02-14 22:36:59.172 [Info] [main] [Environment.swift:71] init() > WebSocket: phase transition to disconnected(error: Optional(Starscream.HTTPUpgradeError.notAnUpgrade(400)), forReset: false)
2022-02-14 22:36:59.172 [Info] [main] [Environment.swift:71] init() > WebSocket: disconnecting; permanently: false, error: Optional(Starscream.HTTPUpgradeError.notAnUpgrade(400))
2022-02-14 22:36:59.172 [Info] [main] [Environment.swift:71] init() > WebSocket: phase transition to disconnected(error: nil, forReset: true)
2022-02-14 22:37:03.883 [Info] [main] [Environment.swift:71] init() > WebSocket: connecting using HAConnectionInfo(url: https://DOMAIN, userAgent: Optional(“Home Assistant/2022.2 (io.robbie.HomeAssistant; build:2022.345; iOS 15.3.1)”), engine: nil)
2022-02-14 22:37:03.925 [Info] [main] [Environment.swift:71] init() > WebSocket: Viability changed: true
2022-02-14 22:37:03.939 [Error] [main] [Environment.swift:72] init() > WebSocket: Error: Optional(Starscream.HTTPUpgradeError.notAnUpgrade(400))
2022-02-14 22:37:03.939 [Info] [main] [Environment.swift:71] init() > WebSocket: phase transition to disconnected(error: Optional(Starscream.HTTPUpgradeError.notAnUpgrade(400)), forReset: false)
2022-02-14 22:37:03.939 [Info] [main] [Environment.swift:71] init() > WebSocket: disconnecting; permanently: false, error: Optional(Starscream.HTTPUpgradeError.notAnUpgrade(400))
2022-02-14 22:37:03.939 [Info] [main] [Environment.swift:71] init() > WebSocket: phase transition to disconnected(error: nil, forReset: true)
2022-02-14 22:37:18.124 [Info] [main] [OnboardingAuth.swift:70] perform(checkPoint:checks:) > OnboardingAuthStepDuplicate: rejected(Starscream.HTTPUpgradeError.notAnUpgrade(400))

Anybody? :slight_smile:

Silly me… had the “Websocket support” checkmark within the NGINX Proxy Manager not turned on. After turning it on and a reboot of the host it’s all working fine.

3 Likes

@henkkeumus

thanks a lot for posting the solution. I had exactly the same issue and also forgot to enable websocket support in nginx proxy manager :slight_smile:
cheers!