Serve static files directly from Tigris

Serving things with Tigris on your own domain usually requires you to go through their custom domain flow, which means that you need to allocate a second domain for your static uploads (eg: We have a new middle ground for you: Tigris bucket statics. Tigris bucket statics let you serve a path of your application with the contents of a Tigris bucket.

One of the main reasons you’d want to do this is if you are moving your uploads from something like Backblaze B2 to Tigris. With Backblaze B2 you can use a custom domain, but you have to prefix the name of your bucket to every single path, like this:

To mount mybucket on the same path as Backblaze B2, you can use a statics definition like this:

url_prefix = "/file/mybucket"
guest_path = "/"
tigris_bucket = "mybucket"

The guest_path directive also lets you change where the bucket is being served from. You can also use this for user uploads, or anything that would involve putting files in buckets. Imagine a photo upload app where the originals are stored in /orig in shashin-uploads and the optimized versions for the public are stored in /public:

url_prefix = "/uploads/public"
guest_path = "/public"
tigris_bucket = "shashin-uploads"

This will serve all of the optimized public assets in /public while keeping all of the original assets away from prying eyes.

Of course, if you want, you can serve your entire app from a bucket:

url_prefix = "/"
guest_path = "/"
tigris_bucket = "evilcorp_website_prod"

Will this be billed as outbound data from the app, or free outbound data from Tigris?

1 Like

Good point!

Any data served from Tigris bucket(s) follows the Tigris pricing policy, which is basically free egress out of Tigris as mentioned in our pricing docs.

Great, I just wanted to confirm that Fly does not add on a data egress charge when using the statics feature introduced here, as opposed to serving directly out of Tigris using a Tigris URL. Is that correct?

We still charge egress when we serve stuff, even though you won’t pay egress for us to get it out of Tigris.