Where does the cache of statics run?

The docs mention there is a cache for statics which is great.

Is this cache running in all Fly regions or only in the ones where the app is deployed?

If not I’d totally pay to have statics cached in all your regions.

Thanks for asking-- always exciting to hear about interest for new features!

Currently, you’d need an app instance in a given region to cache the assets defined in [[statics]] there. This runs on the same host as an app’s VM.

We do eventually intend to cache these on the edge, but we don’t have a timeline for this just yet! What kind of assets are you planning on serving/what kind of app are you planning to deploy?

1 Like

Hi @eli !

I have two use cases:

  1. Static sites (docs and marketing)
  2. Hosting the JS file for an embeddable audio player

This is for the stuff on my root domain and I’m perfectly OK with just having the Fly app running in a couple of regions around the world.

But… if there was a way to cache static assets at the edge on all regions. Well that would be amazing of course :slight_smile:

We agree! I dashed this statics feature off a bunch of months ago just to solve the problem of people having to run web servers in their containers just to serve assets, but almost from the moment we had it deployed, we started thinking about how to roll out edge caching for it. It’ll happen!

3 Likes

That sounds great @thomas !

I just found out that…

Statics will not find index.html at the root. The full path must be requested.

I should have read the docs more thoroughly :sweat_smile:

Unfortunately this is a deal breaker for hosting static sites. Hopefully you’ll be able to improve this in a future update!

Edit:

@thomas would it be possible to use the statics settings in the fly.toml to define a redirect for the index.html file?

Something like this:

[[statics]]
  guest_path = "/app/public/index.html"
  url_prefix = "/"