Connecting to HA locally using HTTPS

If we use a registered (purchased) domain name, does that need to be purely for the use of the certificate? I’ve had a domain for years that’s currently used just to host a blog which I very rarely update. Would I need to change the domain records to point it to my local machine? (I don’t want external access for my Home Assistant server - or anything on my home network with the exception of a couple of services - and am puzzled by the idea of using an Internet domain name for a local certificate.)

Thanks.

1 Like

This is what I did. I purchased a domain because you can have up to four subdomains on free domain. As I use docker installation I wanted a subdomain for all my docker containers. That’s why I purchased a domain. It’s 20 € yearly so it’s not that expensive. I spend way more on beer weekly.
Now the only thing you have to do is to get ssl cert for your domain and subdomains. It’s easy to do it using nginx. I use subdomains for my containers ie. adgurad.mydomain.com
To resolve my domain and subdomains to my ha local ip I use adguard for dns rewrite.
There is a one lack of my setup and that is that I can’t access remotely my docker containers ie z2m. I’m using nabu casa for remote access.
As people said on the forum for remote access you will need that your subdomain is accessible over net and my isn’t and I don’t want to make it accessible. But maybe there is another way but none figured it out.

Sharing my solution for this, if anyone else can benefit from it.

I was running DuckDNS for external access before Nabu Casa came along, but I moved to Nabu Casa because I wanted to support the project and close a port on my firewall.

When attempting to put a button to call assist on my dashboard, I quickly realized that my local connection wasn’t going to work using my IP on mobile, and discovered this thread.

Here’s my solution:

  1. I restored my DuckDNS configuration and it’s maintaining a cert for my home assistant server. I don’t have any ports open on my firewall for Home Assistant.
  2. I happen to be running a NextDNS server on my Synology NAS and it supports rewrites, so I used that to rewrite my myhass.duckdns.org URL to my local IP.
  3. On mobile, I configured my Internal URL to https://myhass.duckdns.org:8123, which NextDNS rewrites to my local IP.

With this, the app is happy and WebSocket and Local Push are connected and available, and Assist works great.

Hope this helps someone with a similar config.

3 Likes

An u write a manual for how to setup exactly

I run homeassistant on a intel nuc
I have a synology.
I need https local because now i can’t talk to my doorbell. Only with https the microphone works

1 Like

Most routers can do this, as most of them come with their own dns server :wink:

I happen to use and like NextDNS for its other features as well, so this was just a bonus.

1 Like

As I read this some months later, I now see exactly what is attempting to be accomplished.

The solution is to follow the steps in this video - just ignore the part about making a firewall rule to let traffic in from the internet.

This video will register a domain name for you (not really that important since you don’t want external access, but it WILL get you a valid FQDN for the cert the be assigned to), then it will show you how to configure the certificate part, and will auto-renew that cert for you, and then it will show you how to configure internal dns for proper name resolution so you don’t get certificate mismatch errors.

Happy TTSing!

3 Likes

Same problem (which I expect should have a common solution) - "How to run Assist (which requires HTTPS) with NGINX setup (which doesn’t use HTTPS for local access).
This is the closest I’ve seen to a solution but am still stumped as to what steps to take.
I also have a Synology but also run a PiHole DNS server. It seems you’re “fooling” HA into thinking it’s accessing a secure HTTPS url but “re-writing” locally is that right? Can this be done on a PiHole?
Thanks.

I’ve found this instruction which is very clear and easy to use:

I only had to put the hostname in quotes.

1 Like

I use WireGuard for VPN access into my network. I have 0 reasons to expose anything via HTTPS outside of my network. I fail to understand why I’m being required to use HTTPS at all within my own local network…

I fail to understand why you feel you are being required to use HTTPS? For what it’s worth, I too am using wireguard when I need remote access. Wireguard is only actually enabled when I am away ftom the house so if I am here VPN is turned off automatically.

The UI of Assist within the GUID for chat doesn’t provide a microphone option noting that you must be connected to home assistant through HTTPs in order to use this functionality – although the connection is within a local network.

This is a browser limitation, not a HA limitation, but yes, if you want to use your device microphone I think you will need HTTPS for this. Again this is the browser that enforces this so unless that changes (not likely) you will need another option. And as I am sure you already know there is no good documentation, to easily implement this for a local network.

Maybe I’m slightly confused on this, but is there something outside of standard browser permissions that trigger this? By chance, do you have a documentation link for the API?

Given I’m also running this as the web app (man I wish it was a native app) as well, permission sandboxes should allow for this. I’ve personally had past projects that allowed for this in a sandboxed web view… Aforementioned they were using HTTP in lower environments rather HTTPS at the time.

You likely already have more experience with this than myself. I continue to run http on my local network. I have not “needed” the https requirement at this point as I am using a couple “satellite” devices with RPI to test with. If you do manage to figure more out, pass it along.

1 Like

I don’t know if someone has already written about it here, but maybe the way I solved it will help someone.
For external access, I have my domain + Let’s Encrypt certificate. It works OK.
I simply added the routing url to the local ip HASS in hosts

c:\Windows\System32\drivers\etc\hosts

localip outerurl #note
(e.g. 10.2.2.10 www[dot]yourouterurl[dot]com #home assistant)

That’s how https[://]www[dot]yourouterurl[dot]com works for me even in the local network. It should work for dynamic dns as well.

Of course replace [dot] with real .

1 Like

But you will need to do this on every machine you use to connect to HA…

Easier would be to resolve the DNS in your dns-server (normally on your router).

It doesn’t work for me on Mikrotik with HA. When I set the redirect DNS on the router, it redirects to the correct IP, displays the initial HA logo, but it gets stuck on unable to connect + retry in 60 sec.
If I do it via hosts, it works OK.

Edit: It works on Mikrotik, but only with static DNS. Layer 7 protocol DNS forwarding +NAT doesn’t work.

Not that i use one, but it should be possible
Check aesmiths reply here
https://forum.mikrotik.com/viewtopic.php?t=182941

He’s using static DNS and it also works on Mikrotik. Thank you. :ok_hand: