How to migrate to a new domain?

I access my HA instance in the browser with http://wilson:8123, where “wilson” is my home server’s name, baked into /etc/hosts. Quite recently – probably due to a new Docker image – HA asked me to add a user account with password. I did so, works fine.

Now I want to make my instance accessible from the Internet. I’d like to access it with a URL like https://mydoman.com. Unfortunately, my login only seems to work for the old URL. At the new URL, the browser waits forever after a login attempt. A reload of the page shows me the login page again.

How can I migrate to the new domain?

The login screen is heavily cached. Try clearing your cookies/history or use incognito mode and browse to the page again to see if your actually connecting.

Without an actual connection you can get to the login screen and I think get the connecting indication, however, it won’t switch to loading data and actually connect.

See if you are actually connecting and then we can trouble shoot from there.

Let’s go one step at a time. Clear your browser cache and try remotely using http://your-router-IP-address:8123.

This is assuming you have already set up your home router for forwarding port 8123 to your HA server.

I was wrong. The new domain was not the problem, the additional TLS was. The browser debugging console revealed that the websocket connection after login failed. Apparently, HAProxy, nginx and the like need to be prepared for websocket-over-HTTPS.

Anyway, I use nginx as the TLS terminator in front of Home Assistant, and https://github.com/socketio/socket.io/issues/1942#issuecomment-82352072 solved the issue.

For easy searching, the exact error message was:

Error during WebSocket handshake: Unexpected response code: 400

Thank you for your answers nevertheless! You are right that clearing the browser cache is even more important here than it is usually when debugging. It is surprising how persistent the (Chromium) cache has been in this case. I once even switched the browser to be sure.