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.
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?
Hi @eli !
I have two use cases:
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
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!
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
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 = "/"
@thomas @kurt what about HTTP cache headers on statics?
Is there a way to control that?
Edit:
Ok just saw in the docs this is not possible either…
Have you been improving statics?
My app is running in these regions:
Region Pool:
ams
hkg
iad
lax
And yet, the statics seem to be served from DFW?
fly-request-id: 01G4E3MG0KRG5DQSBR27WMQM0C-dfw