An Azure service that provides protection for web apps.
Hello Hariprasath Durairaj
I understand that you’re aiming to do make the app publicly accessible but restrict “/admin” to VPN users—is a common setup. However, using a single public listener with a WAF rule based on source IP isn’t reliable because VPN users’ private IPs are NAT’d, so only the public IP is visible.
A better solution is to use Application Gateway v2 with path-based routing and two frontend IPs:
- Set up two frontend IPs on your Application Gateway:
- One public frontend (already used for https://example.com).
- One private frontend with an internal VNet IP.
- Create two HTTP listeners:
- “Public-listener” on the public frontend, port 443.
- “Private-listener” on the private frontend, also port 443.
- Add a path-based routing rule:
- Paths starting with /admin go to the backend via the Private-listener.
- All other paths go to the backend via the Public-listener.
- Connect VPN clients to the VNet where the Application Gateway is deployed. This way, only VPN users can access “/admin,” while other routes remain public.
This avoids relying on WAF source-IP matching, allows you to keep WAF policies on both listeners, and ensures “/admin” is only accessible on the private network.
If you need more info on configuring the second frontend IP or the path-based rule in Azure, let me know.