Question

Spaces. Custom domain and forcing file downloading.

Posted May 26, 2019 1.5k views
DigitalOcean

I want to create a DO space for media files and to use it with my domain.
Also I need an ability to provide download link for each media file.
For example:
http://mydomain.com/video.mp4 - To play video
http://mydomain.com/download/video.mp4 - To download this file

Is it possible and how?
Can you please share a link for steps to configure this.

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.

×
1 answer

Hey there,

A custom CDN endpoint can be used for the domain customization: https://www.digitalocean.com/docs/spaces/how-to/customize-cdn-endpoint/

To make the files act differently (View vs. Download) you’ll want to modify the metadata of the separate files to act differently: https://www.digitalocean.com/docs/spaces/how-to/metadata/

It isn’t possible at this time to show the same file at two separate locations with different behaviour; having the file uploaded twice in Spaces/with separate metadata is necessary.

If you have any other questions or need anything else, just write back in and let us know! Thank you for being a DigitalOcean customer, we are here to assist you 24/7. :)

Regards,
Ethan - Developer Support Engineer II - DigitalOcean

  • I thought that it can be possible to set reverse proxy (nginx) to achieve the aim.
    Isn’t it?

    • You could build a customized application utilizing Nginx as a reverse proxy (tutorial here). We just don’t offer a tutorial that explains all of the details of separating the URL structure.

      If you need assistance with that we recommend working with the Nginx community IRC/WIKI or their mailing list.

      Modifying the metadata on the origin Space will still be necessary unless you want to do that at the proxy level as well.

Submit an Answer