r/devops • • 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 Upvotes

11 comments sorted by

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.

0

u/5977c8e Nov 02 '26

Yea, it is mainly the price point stopping it.

What do yoy mean authZ and authT?

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.

1

u/5977c8e Nov 02 '26

Yea, I guess I did not state it correctly but my main thought for it not being for SaaS was the price point. I guess there is nothing technical stopping it and it is actually quite easy to quickly add, but 7$ dollars per user for a SaaS only for auth is pretty high. I guess there I assumed as ZTNA their business was more to sell extra security ontop of VPNs, where most business know roughly how many employees they will have and it will be somewhat fixed.

Yea, I guess I am going with the worker approach and testing it out. Will need to figure out which hosted solution to use as an intermediary between the IdPs to map the JWT in.

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 

1

u/5977c8e Oct 28 '26

Not sure I completely follow? How would adding multiple IdPs to warp work while using it is an IdP?

Have not worked with warp before.

0

u/[deleted] Oct 28 '26

[removed] — view removed comment

1

u/5977c8e Oct 28 '26

Thanks, I think this will also end up being the solution.

We need a common structure to map what we get from the IdPs to though and currently we do that to Keycloak as an intermediate. Was hoping there was a CloudFlare product that could be a stand in product for that. Otherwise, I guess my options are move the Keycloak outside of our servers or do mappings in the workers before sending them to our servers?