localhost:8123: Home Assistant's default port and remote access

localhost:8123 is the default port of Home Assistant, the open-source home automation platform. On the machine running it, the dashboard is at http://localhost:8123; from a phone or laptop on the same network it's normally http://homeassistant.local:8123 or http://<IP>:8123. Getting to it from outside your home network is the part that takes some setup.

What runs on port 8123

Install typeHow 8123 is served
Home Assistant OS (Raspberry Pi, Green, Yellow, VM)Built in, homeassistant.local:8123
Home Assistant Container (Docker)--network=host, so 8123 on the host
Home Assistant Core (Python venv)hass, listens on 8123

ClickHouse also uses 8123 for its HTTP interface, so on a developer machine check which one you have with lsof -i :8123.

Fix "refused to connect" on port 8123

  1. Give it time. First boot of Home Assistant OS downloads and installs components; the page at :8123 can take many minutes to appear.
  2. Use the IP, not .local. mDNS names don't resolve on every network or OS, especially on some Android devices and across VLANs. Find the IP in your router's client list.
  3. Docker. Home Assistant Container is meant to run with --network=host. With bridge networking you must publish -p 8123:8123, and device discovery won't work properly.
  4. Broken config. If Home Assistant started but the http: section of configuration.yaml is invalid, the web server may not come up. Check home-assistant.log, or run the configuration check from the CLI.

Free or change port 8123

# macOS / Linux
lsof -i :8123
# Windows
netstat -ano | findstr :8123

To move Home Assistant, set the port in configuration.yaml and restart:

http:
  server_port: 8124

On Home Assistant OS, leave 8123 alone unless you have a reason; add-ons and the companion app expect it.

400 Bad Request behind a proxy or tunnel

Put Home Assistant behind Nginx, Caddy, Traefik or a tunnel agent that adds X-Forwarded-For, and you'll often get 400: Bad Request. Home Assistant refuses forwarded requests from proxies it doesn't trust. Tell it which proxies to trust:

http:
  use_x_forwarded_for: true
  trusted_proxies:
    - 127.0.0.1      # proxy or agent on the same host
    - 172.30.33.0/24 # example: add-on network on Home Assistant OS

Use the actual IP or range of your proxy; the log line for the rejected request shows it. Also make sure the proxy passes WebSocket upgrades, because the dashboard runs over a WebSocket at /api/websocket.

Access Home Assistant remotely

Options, from least to most setup:

  • Home Assistant Cloud (Nabu Casa): the paid official service, which also funds the project.
  • VPN (WireGuard, Tailscale): nothing public at all; your phone joins the home network.
  • Tunnel: a stable HTTPS address with no port forwarding, useful when your ISP uses CGNAT or you can't change router settings. Webhook Relay has a Home Assistant add-on and setup guide, and a Raspberry Pi walkthrough using the webhookrelayd agent in tunnel mode. There's also a TLS tunnels add-on guide.
  • Port forwarding 8123 on your router: works if you have a public IP, but puts the login page directly on the internet. Turn on multi-factor authentication first.

Whichever you pick, enable MFA for every user and keep Home Assistant updated.

Webhooks into Home Assistant

Automations can be triggered by a webhook trigger, which listens at /api/webhook/<webhook_id> on port 8123. Services like IFTTT, Zapier or a GitHub Action need a public URL for that. Instead of exposing the whole UI, forward only webhooks:

relay forward --bucket home http://localhost:8123/api/webhook/my-secret-id

The bucket's public URL goes to the sending service, the dashboard stays private, and every delivery is logged. Treat the webhook ID as a secret, since anyone who knows it can trigger the automation.

Frequently asked questions

What is localhost:8123?

localhost:8123 is the default port of Home Assistant. On the machine running it, the dashboard is at http://localhost:8123; from other devices on your network it is usually http://homeassistant.local:8123 or http://IP-ADDRESS:8123.

Why can't I open homeassistant.local:8123?

Either Home Assistant is still starting, which can take several minutes on first boot, or your device cannot resolve the .local name. Try the IP address shown by your router, for example http://192.168.1.50:8123.

Why does Home Assistant return 400 Bad Request behind a reverse proxy?

Home Assistant rejects requests that carry an X-Forwarded-For header from a proxy it does not trust. Add use_x_forwarded_for true and a trusted_proxies list with the proxy's IP address under the http section of configuration.yaml, then restart.

How do I change the Home Assistant port?

Set server_port under the http integration in configuration.yaml, for example server_port 8124, and restart Home Assistant. In Docker you can instead keep 8123 in the container and change the published host port.