@bgachenot said in LAN > Split DNS > WAN issue:
A drawback of doing this would be that, when connected to my network with VPN, I couldn't access the gitlab UI anymore (because HSTS enabled)
Not clear, why HSTS is an issue. Don't you use HTTPS over the VPN?
You should use an internal DNS system like DNS Resolver on pfSense and configure your host overrides there. So you can provide the DNS to VPN clients, so that the clients resolve to the same internal IPs as when you access it from inside your network.
Is there really no way to port forward ports on the same subnet?
Not without masquerading.
When you forward traffic on the router to another device within the same subnet you get following issue:
routers IP: x.0.1
clients IP: x.0.6
server: x.0.10
client sends a request packet to the router (source: x.0.6, dest: x.0.1)
router forwards it to the server (source: x.0.6, dest: x.0.10)
server responds to the source IP (source: x.0.10, dest: x.0.6)
This packet arrives on the client, but he is awaiting the respond from the routers IP x.0.1, where he sent the request to, not x.0.10. Hence the client will not accept the response packet and the communication will fail.
I will create a subnet and move my code-server to it. It should take the gateway for communication with the LAN subnet and pfsense should be able to perform the port forwarding right?
Might be a solution. So each packet has to pass the router and no masquerading is needed.