We have a static img/video http service, and looking for moving that service to DO spaces. I’m wondering does DO spaces support http mirror?

For example,

when a request comes to DO Spaces, and the target path was not exist. Will DO Spaces auto fetch the target file from our http static asset service?

That will save our days of coding.


These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
2 answers

I think you have several solutions each with their various levels of lock-in vs flexibility.

Specifically what you are looking for is best achieved by layering in a CDN that can route requests through several layers of static assets at various hosts to retrieve them and then cache them. This would require the least amount of code but then locks you into that CDN provider.

You could move all of your files over to spaces, and then everything would be served from the built in CDN and obviously there would be only one location to fetch them from if they weren’t cached, which would be spaces, and that would be seamless. But it would require you migrating your files, which could be a bit of a challenge depending on how your assets are laid out currently. So having this happen automatically would certainly be beneficial.

You can also check if there are an open source alternatives that provide this functionality already. Basically where you specify where your assets are located and it handles the auto-routing for you. But then you are also responsible for keeping that routing layer online and active, and it would be receiving the majority of your requests which means high throughput depending on how many assets you have and how many requests you receive.

If I were in your shoes and migrating all of the assets to Spaces was a challenge I would look into an external CDN provider to handle serving and fetching assets.

The one benefit to moving everything to spaces or an Object Store is that once all of the files are there most Object Stores are S3 compatible, so if you had to switch out the object store that would be much easier as you would have compatibility between say Spaces and S3.

  • Hi moisey, thanks for the comprehensive answer.

    We are looking for an alternative solution that can replace the current service alicloud provide. Which is CDN –[source]–> OSS –[source]–> our asset server. That’s really handy and solid to deploy dynamic assets services. Thought the traffic cost of alicloud is too expensive.

    Hope DO will have something similar in the future.

Spaces does not support this type of a service, and this is something that you would have to write internally.

Basically you would need to create a separate service that would take care of the routing for the various requests.

Pushing them to a CDN backed by object storage, and if the file isn’t there, to redirect elsewhere.

The basic service you are describing is how a CDN operates, by storing a local cached copy and then requesting it from a backend service, if the file isn’t present.

So perhaps by layering in your own choice of CDN that has supported for several layers of nested requests you can achieve this.