I am facing a major problem that I cannot quite understand so I hope someone will be able to explain it to me.
I am running multiple services via Docker and expose them with traefik (e. g. via URL scheme app1.mydomain.com). mydomain.com is pointing to my router's public IP address and port forwarding to the server hosting traefik is enabled.
So far, everything is working fine and I can access my application app1 over the Internet.
Now, I want to restrict access for a second application app2 so that it is accessible via app2.mydomain.com but from my LAN only. In order to do that, I created custom DNS entries in my Adguard Home and routed them to my traefik's server IP. In traefik, I configured an ipWhitelist middleware with the sourceRange 192.168.178.0/24 and attached it to the router of app2.
If I use Google Chrome on my Android phone with WiFi enabled, the request succeeds.
If I use Google Chrome on my Android phone with WiFi disabled, the request fails (as expected) with a 403 Forbidden.
Now here's the thing that I don't understand:
If I use a different browser (Brave) on my Android phone with Wifi disabled, the request succeeds! How is this possible? For me, this is a major security implicaiton as I have been hosting sensitive services this way and it seems they were somehow accessible via Internet all along?
I even completely reset Brave (because I thought maybe it somehow cached my internal IP address) and retried but still I can access app2 over the Internet.
So to me it seems an attacker could access all of my sensitive applications by simply spoofing their IP address to be an internal one!?
Apparently the http entrypoint was still working because I didn't assign it with the middleware. I added it now (4th line) and access is being blocked:
EDIT: Solved it finally. Sometimes you have to ask first before you come up with the solution.
Still, thanks a lot @bluepuma77 as your hint with the access log led me to success!
I had to specify a global redirection scheme rather than via middleware: