Can't access my server with domain when in VPN

Hello,
I have the following scheme. Within my network I have a server that is accessed through a domain. I have the ports appropriately redirected and everything works correctly. Both from inside the network and from outside I access without problems.
The problem comes when I want to access, through the domain, being connected to the router by VPN. It does not matter if I connect with Wireguard or with OpenVPN, in both cases the error is ERR_CONNECTION_REFUSED. If I access through the local IP, I access without problem.
I have discovered that if in the port forwarding, I duplicate them and in the external zone, instead of WAN, I put Wireguard Server (or OpenVPN) and redirect it to the server IP, it starts to work. The problem is that if I redirect port 80 and 443 ALL the traffic of those ports is sent to my internal server, so, in practice, I lose access to the Internet while I am connected to the VPN. With this I have discovered that, since the traffic does not come from WAN, the call to port 443 or 80 is processed by the router and is not allowed because those ports are not active.
How do I configure this properly so that the server works by accessing the domain and does not go to the router while I am in VPN?

I have a Flint2 with 4.6.4

Thanks

You will need a split DNS setup where the used DNS server (so mostly the Flint?) will answer with the local (!) IP of your server while asked via VPN.

Sorry, I don't know if you mean using different domains or subdomains for internal or external access or make a DNS rule in the Flint2 so when I am in the VPN it overrides the DNS resolution for the domain and gives internal address.
This second solution is not going to work always because it depends on the device using the DNS of the router, if I am not wrong.
Tried going to DNS - Edit hosts and adding the line with internal IP but is not working because of device is using secure dns forced in the device.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.