Accessing external subdomain when inside local network?

I found multiple threads with the exact same issue, but after testing everything I could find, I am out of ideas.

I have a Unraid server on my local network (192.168.1.2) which runs a few things, like Home Assistant. I have NGinx Reverse Proxy setup to be able to access Home Assistant externally with a .com address. This works really great, and it is setup so I can reach Home Assistant via http://home.domain.com and all services has a subdomain.

At first I could not reach my external domain when using my local network, until I added address=/domain.com/192.168.1.2 in dnsmasq.conf.
Now I am able to use this domain locally. Going to http://domain.com takes me to my Unraid server login. Using http://home.domain.com takes me to the Unraid server login too. So everything points at the server (192.168.1.2) whichever subdomain I use. It seems like Nginx Reverse Proxy does not do anything to point me to the correct service.

I have tried adding this to my firewall:

config redirect 'homeassistant'
	option proto 'tcp'
	option src_dport '80'
	option dest_ip '192.168.1.2'
	option dest_port '8123'
	option src 'wan'
	option name 'Home Assistant'
	option target 'DNAT'
	option ftype '1'
	option dest 'lan'
	option reflection '1'
	option reflection_src 'external'

This does nothing either. Still reaching my Unraid login when using the subdomains.

Using everything when not connected to my local network, I have no issues at all, and externally only the subdomains are reachable (as I don't want my Unraid login public).

Additional information.
I have no issue reaching Home Assistant when connected locally using the external domain + port: http://domain.com:8123
It is the subdomain which is not reachable without ports.

As I said before, this works as it should outside my own network, with no need for port and only using the subdomain.

Sounds like a Nginx, rather than an OpenWRT, problem to me.

I am not sure I agree with that. As it is setup and works perfectly externally. It looks like what breaks it is internal routing. If my router would allow me to reach external domains locally this would not be an issue. I am sure part of the issue is that the dnsmasq.conf address=/domain.com/192.168.1.2 points the domain including all subdomains to the same place.

What IP address would you like to point the subdomains at?

The same IP-address as the Unraid server, it is a docker container that runs on the same server, just a different port. So 192.168.1.2:8123 for Home Assistant. Everything I can find online says this is a router issue, NAT Loopback / Hairpin. But I cant manage to set it up correctly.

For external traffic where does the change of port take place? So for Home Assistant are you connecting externally on port 80 (or 443 if using HTTPS)? If so, are those ports forwarded to the reverse proxy or are they altered in any firewall rules?

I got my domain and subdomains pointed to my external IP. The NGinx Reverse Proxy is setup so that the subdomains points to the local adress "192.168.1.2:8123". I have a port forward on the router for 192.168.1.2 from external port 80 to internal port 8080 and external port 443 to internal port 4443. Which means everything which hits my external domain, will go to my external IP, then the router which forwards 443 or 80 to 4443 or 8080, which in turn lets Nginx Reverse Proxy pickup and get you to the correct destination. And as I said, this works great when not on my local network.

Can you add multiple DNS services to /etc/config/ddns, one which locally resolved, and one external for stuff like my issue?

The problem isn't with DNS or OpenWRT. It's to do with your nginx config. You either need to use 8080 or 4443 at the end of addresses when accessing internally, change nginx to listen on port 80 or 443, or (the nuclear option) reconfigure your network so the firewall can get involved with internal traffic to the server and change the ports.