home-assistant / home-assistant/iOS

Starscream.HTTPUpgradeError

Open
#3,618 5 comments 1 reaction 0 assignees View on GitHub
bug ios
Dominant language
Swift
Stars
2.4k
Forks
520
Avg merge
7h 27m
Merged PRs (30d)
264

Description

Model Name: 2 iPhone models, 1 iPad
Software Version: iOS 18.5
App version: Latest as of 5/26/2025 (can't get into the app to check, re downloaded from App Store)

**Home Assistant Core Version**
2025.5.1

**Describe the bug**
App is not using secure HTTP for the websocket upgrade when adding a new server.
"We couldn't connect to Home Assistant"
Starscream.HTTPUpgradeError

**To Reproduce**
Add a new server using the HTTPS scheme

**Expected behavior**
App connects using secure HTTP for all API calls, including the websocket upgrade

**Additional context**
I specify https://servername/ when adding the server but:
In nginx access log, I see 301 redirects to HTTPS on the /api/websocket endpoint
In the app I get a Starscream.HTTPUpgradeError
In the exported app logs I see
`[Error] [main] [Environment.swift:75] init() > WebSocket: Error: Optional(Starscream.HTTPUpgradeError.notAnUpgrade(301, ["Server": "nginx/1.26.3 (Ubuntu)", "Content-Type": "text/html", "Date": "Mon, 26 May 2025 03:17:41 GMT", "Connection": "keep-alive", "Location": "https://dev-hass.makerland.xyz/api/websocket", "Content-Length": "178"]))`
With TCPdump I see traffic going to port 80
`04:05:09.417593 eth0 In IP 10.3.5.140.52083 > hass02.makerland.xyz.http: Flags [S], seq 600926463, win 65535, options [mss 1460,nop,wscale 6,nop,nop,TS val 4049053127 ecr 0,sackOK,eol], length 0`
In the configuration.yaml, I've defined the URLs with HTTPS also. **HTTP isn't mentioned anywhere** but starscream is trying to connect via insecure websocket. Not sure if that makes it a bug better suited for the starscream repo. I can't tell if it's a bug in the implementation of the library or the lib itself. Swift is up there with the programming languages that confuse me the most.
I can connect just fine in Safari. Right now I have the webpage added to my homescreen.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.