digitalocean spaces cdn with subdomain shows access denied when access file with subdomain

Posted March 17, 2020 2.5k views
Block StorageCDN

i have setup a cdn for spaces with custom domain. when i try to access the file with custom subdomain it shows access denied. but when i use the spaces main url i can acess it. but not working with cdn subdomain

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
1 answer

Hi there @lilboat,

What is the exact error that you get in your web console?

Have you tried following the steps from this video here on how to set that up:


  • Hi Bobby,

    I’m having exactly the same problem. I followed the steps from the YouTube video above with the exception that:

    • I first created my spaces without a CDN subdomain (a couple of days ago)
    • today I added a subdomain

    -> Then I created an object using NodeJS which is present and downloadable as test_0.txt.

    -> Then I made this file public.

    What happens:

    • When I access this file through its “Origin” URL I can simply download it in a browser.
    • When I access this file through its “Edge” URL then I get 403 Forbidden.
    • When I access this file through its “CDN” URL then I also get 403 Forbidden.

    Any idea what can be wrong?

    • I have an update to my previous comment: it seems that it was a cache issue.

      If I try to access a resource via CDN but get access denied, then make it public and try to access it again, I still get access denied. But after waiting >1 hour the CDN link started to work again.

      When I do it the opposite way: first make a resource public and then try to access it via CDN, it seems that it works immediately.


      Therefore it seems like a cache issue to me - maybe intentional since the CDN cache life time is 1 hour.

      • Hi there,

        Are you still seeing the problem or was it just caching?


        • @bobbyiliev

          Yes, I’m almost sure it’s a logical side effect of CDN.

          1) If I first set permissions to Public then I can access the file from the public CDN immedaitely.

          2) If I fist access the file through (CDN), get access denied, then set permissions to Public then I keep getting Access Denied (for some time). However, if I modify the URL slightly (e.g. if I add ?x=1) after the URL then it starts working immediately. I would correspond with my theory of caching on CDN.