Cloudflare Zero Trust on a VPS, Load Balancer, HTTPS
I'd like to set up 2 VPS with Hasura and cloudflared (via docker-compose), with all incoming traffic blocked, and a cloudflare load balancer listening to hasura.example.com, routing traffic to both VPS based on some rules. I'd like to have HTTPS working, without installing certs on hasura, so just let cloudflared handle it.
Is this something that would work in theory? I've tried different things (like hooking up caddy in between, as reverse proxy and a lot of different configs), but I just can't get it to work. Most of the time, I end up with ERR_SSL_VERSION_OR_CIPHER_MISMATCH when trying to access hasura.example.com.
Here is an example config using caddy (hope I don't even need caddy). With that config, I was at least able to connect the loadbalancer (to origin 100.90.0.5 on the virtual network).
* SEE BELOW FOR EXAMPLE, POST WAS TOO LONG TO ADD IT HERE *
Something I'm currently experimenting with is, without caddy, using cloudflared config to point the hostname to hasura docker container, but I'm not sure which origin I can then let point the loadbalancer to.
Has anyone got an idea? Thanks!
11 Replies
That error typically means there is no SSL certificate covering the domain. Do you see one in your universal SSL certificate page?
Hmm.. right @Cyb3r-Jok3 , I supposed adding an LB with CF proxy would create the cert, thanks for the hint.
Still interested in the best way to achieve what I need, do I need caddy with the CF origin cert setup or is it possible to just use cloudflared?
You can do http/https from cloudflared to the origin. Typically you would use something like caddy in front of it if you were using its features
Yeah, but I'm using caddy exclusively as reverse proxy to hasura, so can I https via cloudflared and proxy it to hasura via http?
thanks for your help @Cyb3r-Jok3 , I find it very hard to find the right configs for LB + cloudflared + https, not much info around
Yeah you can
How does it work?
Setting the cloudflared config to something like this:
What origin am I supposed to point the LB to? How do I get a certificate?
Cloudflare Docs
Load balancers · Cloudflare Zero Trust docs
When you create a tunnel, Cloudflare generates a subdomain of cfargotunnel.com with the UUID of the created tunnel. You can treat …
The edge certificate will be auto issued
So, I need to leave the "Virtual Network" empty and use origin
$tunnelID.cfargotunnel.com
?
thanks for linking the article
going to try this outneverlucky 😛 maybe need to try later