nickchomey
CDCloudflare Developers
•Created by nickchomey on 9/19/2024 in #general-help
Is it possible to add routes to a Cloudflare Remotely-managed Tunnel via API calls?
Remotely managed tunnels seem to have a lot of advantages over locally managed tunnels - they're simpler to set up, have the webui etc...
But there's certainly advantages to doing everything from the CLI - eg changing CNAME records for the tunnel via API calls, with flarectl. The downside to this is that we seem to need to restart the cloudflared service in order to incorporate changes make to the config.yml tunnel configuration file.
Is there any way we can set up a remotely managed tunnel, but then modify its routes via api calls rather than the web UI?
27 replies
CDCloudflare Developers
•Created by nickchomey on 6/19/2024 in #general-help
Multiple hostnames/domains with locally managed tunnels?
I'd like to locally manage tunnels programmatically via the CLI. I want it to be able to route requests from multiple domains and subdomains to different sites that are behind a Traefik router.
When I
cloudflared tunnel login
, it asks me to select a zone/domain. Let's say that I select nick.com
I can then create a tunnel with cloudflared tunnel create nick
If i then run cloudflared tunnel list
, it shows various tunnels that I've created previously - both via the dashboard and CLI.
If I create a route cloudflared tunnel route dns nick 1.nick.com
, i get the response Added CNAME 1.nick.com which will route to this tunnel tunnelID...
.
If I create a route cloudflared tunnel route dns nick 2
, i get the response Added CNAME 2.nick.com which will route to this tunnel tunnelID...
. So, the tunnel seems to very much be tied to a specific domain (nick.com
).
If I then run cloudflared tunnel route dns othertunnel 1.othertunnel.com
, i get the response Added CNAME 1.othertunnel.nick.com which will route to this tunnel tunnelID...
.
So, it seems like when I am logged in via cloudflared CLI, even though you can see your account's different tunnels, you can only actually use one of them at a time. Moreover, even if you try to create a route on a different tunnel, it'll get created on the one you are currently logged-in to. Is this accurate?
As far as I'm aware, if we use remote-managed tunnels, we can create routes with any of our domains. So, how are we supposed to do something similar with locally managed tunnels? I'm trying to make it all programmatic, so that I can integrate it into the fantastic open-source DDEV (https://ddev.com/) development environment, which is a wrapper around docker for developing with pretty much any PHP CMS or Framework I really don't want people to have to keep going to their dashboard to manually change things - it should just be a CLI command that magically does all the tunnel routing.
Any suggestions? Thanks!44 replies
CDCloudflare Developers
•Created by nickchomey on 12/8/2023 in #workers-help
Difference between `node_compat = true` and `compatibility_flags = [ "nodejs_compat" ]`?
The docs say that we should add
compatibility_flags = [ "nodejs_compat" ]
to wrangler.toml in order to use node modules. But the errors I get when running wrangler tell me to add node_compat = true
instead. Only the latter seems to work. What's the difference? Is the former deprecated and the docs out of date?4 replies
CDCloudflare Developers
•Created by nickchomey on 11/16/2023 in #workers-help
Smart Placement and Service Bindings
Is it possible to have a Worker that is edge-based/doesn't use Smart Placement that has a service binding to another worker that does use Smart Placement? Or do service bindings explicitly work on workers that are within the same datacenter/in the same "application space"?
(please dont ask the use case - it is sure to sound stupid, but makes sense to me).
3 replies
CDCloudflare Developers
•Created by nickchomey on 11/14/2023 in #workers-help
Confused about Caching with Fetch API within Workers
I would like to cache requests made from the Workers Fetch API in the Tiered Cache, which can then be periodically purged globally by URL.
This page (https://developers.cloudflare.com/workers/learning/how-the-cache-works/#interacting-with-the-cloudflare-cache) says that all fetches are cached automatically, IF they are proxied through Cloudflare. And the caching can be further customized by operating on the
cf
object, as in this example https://developers.cloudflare.com/workers/examples/cache-using-fetch/
However, my question is whether it would get cached if I
a) do not own the site, and/or
b) it is not an active zone on Cloudflare
I ask this because in this section (https://developers.cloudflare.com/workers/learning/how-the-cache-works/#single-file-purge--assets-cached-by-a-worker) of the same Workers Cache documentation, it shows a decision tree for cache purging.
1. If the page is not an active CF zone, it can be purged (but how was it cached to begin with?)
2. If it is an active CF zone, but not proxied, it can be purged (again, how was it cached to begin with?)
3. If it is proxied and you own it, you can purge it
4. If you do not own it, it cannot be purged
I think I am confused because it isn't clear how a page that isn't active or proxied (1 and 2) can be cached in the first place. Moreover, why can those be purged but #4 can't?
Surely I'm missing something fundamental about how this all works. I hope someone can clarify for me!4 replies
CDCloudflare Developers
•Created by nickchomey on 11/13/2023 in #general-help
Where does Cache fit into the Traffic Sequence?
15 replies
CDCloudflare Developers
•Created by nickchomey on 11/13/2023 in #general-help
CF Snippets capabilities
Is there any documentation on what capabilities Snippets have? In particular, I'm curious if it can it do anything with the Cache, as well as if the HTMLRewriter is available in it
5 replies
CDCloudflare Developers
•Created by nickchomey on 8/27/2023 in #general-help
Where can I find Traffic Sequence in the Dashboard?
I've looked in seemingly every menu/page of the dashboard and can't find the Traffic Sequence anywhere. Am I missing some account setting or something?
11 replies