In that case, you might want to edit / update / clarify the 1st post of this thread, with all the supporting info about your LAN network, and with boundary conditions (no cost solution, etc.)
The setup screen from your companion app would be key also. Do not omit any detail - otherwise the forum would have to guess and thus might not be helpful.
====
… or maybe… is it just me not understand these sentences…?
Companion app on my Android phone is configured with Home Assistant URL set to my DuckDns address (https://_________.duckdns.org:8123/).
To reiterate my problem, when my phone is connected to my home WiFi network Home Assistant Companion can’t connect to Home Assistant and display the error message can’t connect to Home Assistant.
In order to solve this problem, I’m looking for a free solution and won’t mind reconfiguring my network, tweaking Home Assistant or both.
It could be a quick config change. Like I said, the screenshot (which is still missing) of the setup screen in your Companion app is key. The information below is not enough.
Now,
If you use this address http://192.168.11.4:8123 from the browser of your PC, would you be able to connect to the HA? (Attention: use http, not https)
If you use the same address from the browser of your phone, when it is connected to your home wifi, would you be able to connect to HA?
If yes to both.
Grant location permission to your Companion app. Go into your Companion app, open the setup screen, plug in your Home Network WiFi SSID, and use http://192.168.11.4:8123 as your Internal Connection URL… and maybe play with the Prioritize Internal URL switch and see what works better.
If this works, then you don’t need AdGuard nor Dnsmasq, you don’t need nginx or any reverse proxy, and you don’t need to change your remote access setup (which is already working).
=== may or may not related ===
You might want to change the DNS on your HAOS into 1.1.1.1 or 8.8.8.8.
What’s the primary and secondary DNS, when you setup your DHCP server on your router? Or is your router only give you the option to enable / disable DHCP plus IP range? Note that, depends on your router, this DNS setup under DHCP may not be the same that your router would be using, which is your ISP Gateway.
What exactly is/are the DNS server(s), that your PC obtains automatically?
from my computer http://192.168.11.4:8123 : no access (ERR_EMPTY_RESPONSE)
https://_________.duckdns.org:8123/ : no access (ERR_CONNECTION_REFUSED)
from my phone using the internet browser (when connected to my home WiFi network) https://192.168.11.4:8123 : access http://192.168.11.4:8123 : no access (ERR_EMPTY_RESPONSE)
https://_________.duckdns.org:8123/ : no access (ERR_CONNECTION_REFUSED)
By default, the router LAN IP address but but it seems they can be manually configured.
This works? That’s good news. I do not know how you handle certificate from inside your LAN, but if this works, then:
(a) plug in your home wifi SSID into this Home Network WiFi SSID
(b) use https://192.168.11.4:8123/ in the next field, the 内部接続のURL
(c) disable AdGuard and DNSmasq (at least for now) and don’t touch the DNS settings under DHCP just yet.
(d) test around. test the switch of 内部URLを優先 and see which works better.
What were the odds I encounter someone who also understand Japanese on my first post!
I followed your instructions to the letter and … I’m sorry to report that it didn’t work.
I may have omitted an important information in my previous reply
I managed to access HA with my phone via https://192.168.11.4:8123 but after I ignored a certificate error message from Chrome.
Just a quick test first: use http instead of https in that 内部接続のURL field, and see if that works.
If that wouldn’t work either, I see 2 routes going forward:
Figure out why http would not work. By default HAOS should allow http, at least from your home LAN (anyone with 192.168.11.xxx), so something else is going on. Is that a setting in your router? gateway? HAOS? I unfortunately do not know where to start on this one.
Try AdGuard Home
2a) First we setup AdGuard Home, likely from that community add-on, in your HA box (RPi) - following the documents of that add-on.
2b) Then we add a rule, to rewrite the yourname.duckdns.org with a local IP 192.168.11.4
2c) Then we config and enable DHCP in your AdGuard Home, at the same time we point these on your router to 192.168.11.4
(save, restart, reboot, verify, etc., so that AdGuard would be active, and your wifi clients are getting DNS server instructions pointing to AdGuard Home @ 192.168.11.4, and blocking ads for your lan.)
2d) Use nslookup command from your PC, to verify that it would indeed resolve yourname.duckdns.org with 192.168.11.4
2e) Clear both 内部接続のURL and Home Network WiFi SSID settings in your Companion app. And then save & test.
I guess route #1 would be easier, if we know where to start.
And maybe other members here in the forum has other ideas.
https://xyz.duckdns.org - this will a valid https connection with a valid certificate
if your router supports reverse NAT, when you hit duckdns domain, all would work fine. Some routers does not support this and you end up setting up nginx to take care of this.
when you move forward with nginx,
you set your router 443 port to nginx server and you use https://xyz.duckdns.org, which will redirect to nginx and then home assistant (over http)
you can use http://local.ip.address:8123
in this option, as home assistant is not enabled with https, your mobile app would not fail to connect any of these hosts. inside mobile app, you will set your internal URL and external URL, so depending on SSID you connected, it will either try internal URL (no https) or external URL (https).
P.S.: I was a bit lost on overall thread, so I just summarized, pardon me I this had been covered already.
@misterobotique - All else are equal, this is likely the same or less amount of work, comparing to route #2. I’d start with the NGINX Home Assistant SSL proxy add-on, along with your existing Duck DNS.
in the Configuration tab, under Options I replaced home.example.com by my DuckDns address
I configured my Wifi router to direct port 443 traffic to port 443 of my HA machine
I restarted my router and Home Assistant
accessing HA via http://192.168.11.4:8123, I started NGINX Home Assistant SSL proxy add-on and waited a few minutes until I could see “Running nginx…” in the log.
on my phone, I opened Home Assistant Companion and in settings:
I am a little bit lost with this very long posts. At the end, did you change the DNS settings on your wifi router? Seems like you said it above, but you didn’t mention it here in your solution.
Same: what the 172.30.33.0/24 relates to, your address seems to be 192.168.X.X?
Sorry for the extremely late reply, I haven’t logged in for a while.
At the end, I didn’t change the DNS settings on my WiFi router.
Regarding 172.30.33.0/24, I don’t know. I just follow the documention on how to use " NGINX Home Assistant SSL proxy" and it requires to add this to the configuration.yaml.