r/devops • u/5977c8e • Oct 28 '26
Discussion CloudFlare Tunnel with pre-auth (and multiple IdPs)
I am working on setting up CloudFlare tunneling for a SaaS product in order to get WAF in front of the application and potentially use the CDN for faster distribution.
In the process there was also a requirement to move over to using pre-authentication in front of our SaaS solution, so that all requests are authenticated before they even hit our servers (similar to Azures application proxy).
It was suggested to use CloudFlare access, but this seems to more targetted towards internal apps and replacing / addition to a VPN in order to get ZTNA.
What would be a good way be to setup this pre-authentication? To me it seems there is no CloudFlare solution that handles this, so either I have to setup something to handle this check on CloudFlare or find a different vendor.
1
u/angellus Oct 28 '26
Pre-auth in front of a Web app is like the definition of ZTNA and sounds like exactly what Cloudflare Access does.
If you do want more of the advanced authZ features of Access, it will cost you per seat. Which will get pricy. But authT is completely free. Then just handle groups and access in your app.
1
u/kdotp5 Oct 28 '26
Access isn’t only for internal apps. A self-hosted Access application works on any public hostname behind your tunnel, and you can turn on several IdPs (plus one-time PIN) on the same app so users pick at login. Point the tunnel at your origin with no public ingress, then validate the Cf-Access-Jwt-Assertion header at the app so nothing can bypass it.
The real catch for SaaS is pricing. Access is per seat, so if all your customers’ users count as seats it gets expensive fast. If that kills it, the Worker approach is the way to go: have the Worker validate a JWT from your own IdP broker (Auth0, Keycloak, Okta CIC, etc.) and keep the tunnel and WAF as is. Either way, plan service tokens or bypass rules for health checks, webhooks and API clients.
2
u/Immediate_Wheel1953 Oct 29 '26
I would keep Keycloak as the broker and let the edge check only prove the user is authenticated, not decide what they can do. I tried mapping groups at the edge once and ended up with two different answers in different places when a customer renamed a group, which was a pain to untangle. If the Worker just passes through a normalised set of claims and your app still checks them against its own roles, you keep one source of truth. That also makes the tunnel and WAF part much simpler, because you are not asking them to understand your customers.
1
u/Odd-Wind8323 Oct 30 '26
The tricky part with multiple identity providers is keeping the authentication flow predictable, especially when users need access to different internal services. Id map out which provider should handle each group and make sure authorization is enforced consistently after authentication, rather than relying on the tunnel alone. Its worth thinking through the same identity and access questions that come up in trusted tech environments before adding more complexity.
0
u/abofh Oct 28 '26
Add multiple idp to warp, use warp as the idp for the apps, require gateway
0
u/[deleted] Oct 28 '26
[removed] — view removed comment