Hello Sebastiaan Mangoentinojo,
Thank you for posting your question in the Microsoft Q&A forum.
I appreciate you explaining the complex scenario very well with including details such as the diagram, this helped!
If I understood your networking setup in Azure, the issue you are facing is related to Azure's handling of source IP addresses and its anti-spoofing mechanisms. Azure enforces strict anti-spoofing rules to prevent IP spoofing. If a VM sends traffic with a source IP that doesn't match its own IP (or a range explicitly allowed), Azure drops the packets. Your firewall is performing DNAT (changing the destination IP to the reverse proxy's IP) but not SNAT (preserving the original client IP). This causes Azure to drop the packets because the source IP doesn't match the firewall's IP. Even with IP forwarding enabled on the VMs, Azure's underlying network fabric will still enforce anti-spoofing rules.
You may try few ways to resolve the issue, please also explore documentation to understand best suitable option:
- Use Azure Load Balancer with Direct Server Return (DSR), Azure Load Balancer can be configured to preserve the client's source IP by using DSR mode (also known as Floating IP). However, this works for TCP/UDP traffic but may not support all advanced firewall features.Useful link to refer - https://learn.microsoft.com/en-us/azure/load-balancer/load-balancer-floating-ip
- Use Azure Application Gateway is a layer 7 load balancer that can preserve the client's original IP address using the X-Forwarded-For header. However, this requires the reverse proxies to support and trust the X-Forwarded-For header. Useful link - https://learn.microsoft.com/en-us/azure/application-gateway/application-gateway-faq#how-do-i-preserve-the-client-ip-address
- Use Azure Route Server with BGP If you're using NVAs, you can leverage Azure Route Server to advertise routes and bypass Azure's default anti-spoofing rules. However, this may require advanced networking knowledge and BGP configuration. Useful link - https://learn.microsoft.com/en-us/azure/route-server/quickstart-create-route-server-portal
Given your requirements, the Azure Load Balancer with DSR (Floating IP) or Azure Application Gateway are the most straightforward solutions. If these don't meet your needs, consider using an NVA with source IP preservation or Azure Route Server with BGP. Also, before deploying any solution in production, thoroughly test it in a non-production environment to avoid any disruption.
If the above answer helped, please do not forget to "Accept Answer" as this may help other community members to refer the info if facing a similar issue.