You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I would like the ability to purge a pullzone's cache from the bunny CLI, something like bunny pullzone purgecache. I know there's know there no pullzone subcommand yet, but there's an existent HTTP API for it:
POST https://api.bunny.net/pullzone/{id}/purgeCache
I really like the flow of bunny storage link [zone], it'd be great to have bunny pullzone link [zone] that allows easily running bunny pullzone purgecache on the configured pullzone.
I would use this as part of the deploy flow for my static sites hosted on Bunny.net.
I see there's a bunny site subcommand that calls out to this API already:
// Point production at a deploy: retarget the rewrite rule and purge. The rule propagates async, so purge, wait for the edge to serve it, then purge again so nothing stale survives (the header can confirm on a cached response, which is why the second purge is load-bearing).
exportasyncfunctionpromoteDeploy(opts: {
coreClient: CoreClient;
state: RemoteSiteState;
deployId: string;
}): Promise<void>{
const{ coreClient, state, deployId }=opts;
constpurge=()=>
coreClient.POST("/pullzone/{id}/purgeCache",{
params: {path: {id: state.pullZoneId}},
body: {},
});
(Related, but I don't see any docs for the bunny sites CLI at https://bunny.net/docs/cli but it seems quite nice and related to what I am rolling on my own.)
Great questions! And really good to hear you like the link command. Makes it so much easier when working in a project with a library, PZ, script, etc.
I've been meaning to merge Added basic PZ commands #86 as experimental so users can try it out. I just didn't want to merge it and it be forgotten about with no continuous updates. I'm trying to plan now work on the remaining commands to get those in (feat(stream): import #224 , feat(stream): video libraries, directory linking, uploads, and video management #203 and Apps are next, then PZ). However, you can use the CLI to call the purge endpoint with: bunny api POST /pullzone/12345/purgeCache or if you have a tag: bunny api POST /pullzone/12345/purgeCache --body '{"CacheTag":"product-42"}'
bunny sites is not yet released, probably will blog about this next week - it's been in heavy testing by a few users, and is intended to be a CLI only thing for now with the github action, and if it picks up steam, add it to the Dashboard with an API. Feel free to use it and let me know how it goes, and if it's missing anything you'd like that makes your workflow better.
@jamie-at-bunny that's awesome about the PZ PR, I didn't notice it. Sounds good about the bunny api command. 👍 I'm using bunny sites for a new website I made today and so far, so good. Really easy and nice to use. Cool to see how it's all wired together with the edge rules and such. I'll close this issue out then, sounds like it'll all on its way. I'll log any bugs if I run into them!
@brettchalupa that's awesome to hear! I merged PR #86 so the next release should provide the same pz link experience as every other command.
I'd love to learn a bit more about your use case too, I plan to add the ability to add functions folder support to sites too, so static sites can still by dynamic in places. Feel free to reply here, or email me jamie [at] bunny
@jamie-at-bunny right now I am using Bunny CDN to host a handful of static sites. I push each site to a Storage Zone and have a Pull Zone with a custom domain. I push the generated site to the PZ and then bust the cache with this Ruby script that calls out to the bunny CLI:
#!/usr/bin/env ruby## Upload the built ./book to Bunny.net Storage Zone in parallel.## Requires `bunny` CLI and a configured storage, e.g. `bunny storage link my-storage`# Supports optional `--dry-run` and `--jobs N` argsDRY_RUN=ARGV.include?("--dry-run").freezeJOBS=(ARGV[ARGV.index("--jobs") + 1].to_iifARGV.include?("--jobs")) || 8DIR="_build".freezefiles=Dir.chdir(DIR){Dir.glob("**/*").reject{ |f| File.directory?(f)}}queue=Queue.newfiles.each{ |f| queue << f}workers=Array.new(JOBS)doThread.newdowhile(f=queue.pop(true)rescuenil)command="bunny storage files upload #{f} --to #{f}"ifDRY_RUNputs"[DRYRUN] " + commandelseunlesssystem(command)puts"FAILED: #{f}"endendendendendDir.chdir(DIR)doworkers.each(&:join)endputs"Clearing cache..."system("bunny api POST /pullzone/#{PZ_ID}/purgeCache")
So in a lot of ways a less fancy version than the bunny sites functionality that exists with the deploy folders and edge rules.
I also have some sites where I want more robust redirect logic or some dynamic functionality, so I've experimented with using edge scripting middleware. So the functions support would be quite nice, especially if there was an easy way to test that locally while serving the site locally.
But yeah, that's basically my usecase right now: static site hosting with CLI-based deploys from my local machine.
Activity
[-]Pullzone command & ability to clear cache[/-][+]Pull zone command to purge cache[/+]jamie-at-bunny commentedon Sep 25, 2026
Hey @brettchalupa
Great questions! And really good to hear you like the
linkcommand. Makes it so much easier when working in a project with a library, PZ, script, etc.bunny api POST /pullzone/12345/purgeCacheor if you have a tag:bunny api POST /pullzone/12345/purgeCache --body '{"CacheTag":"product-42"}'bunny sitesis not yet released, probably will blog about this next week - it's been in heavy testing by a few users, and is intended to be a CLI only thing for now with the github action, and if it picks up steam, add it to the Dashboard with an API. Feel free to use it and let me know how it goes, and if it's missing anything you'd like that makes your workflow better.brettchalupa commentedon Sep 25, 2026
@jamie-at-bunny that's awesome about the PZ PR, I didn't notice it. Sounds good about the
bunny apicommand. 👍 I'm usingbunny sitesfor a new website I made today and so far, so good. Really easy and nice to use. Cool to see how it's all wired together with the edge rules and such. I'll close this issue out then, sounds like it'll all on its way. I'll log any bugs if I run into them!jamie-at-bunny commentedon Sep 28, 2026
@brettchalupa that's awesome to hear! I merged PR #86 so the next release should provide the same
pz linkexperience as every other command.I'd love to learn a bit more about your use case too, I plan to add the ability to add
functionsfolder support to sites too, so static sites can still by dynamic in places. Feel free to reply here, or email mejamie [at] bunnybrettchalupa commentedon Sep 28, 2026
@jamie-at-bunny right now I am using Bunny CDN to host a handful of static sites. I push each site to a Storage Zone and have a Pull Zone with a custom domain. I push the generated site to the PZ and then bust the cache with this Ruby script that calls out to the
bunnyCLI:So in a lot of ways a less fancy version than the
bunny sitesfunctionality that exists with the deploy folders and edge rules.I also have some sites where I want more robust redirect logic or some dynamic functionality, so I've experimented with using edge scripting middleware. So the
functionssupport would be quite nice, especially if there was an easy way to test that locally while serving the site locally.But yeah, that's basically my usecase right now: static site hosting with CLI-based deploys from my local machine.