2

I wondering the rationale behind the big social networks folder structures for images they hold. I'm creating an API for a smaller social app with endpoints similar to the following:

https://api.example.com/v1/users/<id>
https://api.example.com/v1/users/<id>/posts/<post_id>

and users can upload profile images via a PUT call to:

https://api.example.com/v1/users/<id>/images

Now the images are served through nginx and for example you can access the profile image via:

https://cdn.example.com/images/user/<id>/profile/<imagename>.jpg

So what I'm wondering is why Facebook, Twitter, Instagram and all those guys have structures similar to this giberish:

https://fbcdn-photos-d-a.akamaihd.net/hphotos-ak-xal1/v/t1.0-0/p480x480/10329215_977076969053738_7417509963714441891_n.jpg?oh=64aecaca7a84139c16e8a0f579782034&oe=57880BF0&__gda__=1469390211_f894185cc7e133738a0b9321e28e53c3

I'm aware they have insane levels of images to serve and they are across many servers, but I can't make sense of the URLs.

unor
  • 92,415
  • 26
  • 211
  • 360
CaptRisky
  • 751
  • 4
  • 13
  • 25
  • _“but I can't make sense of the urls”_ – you’re not supposed to (from a user perspective). Otherwise you could try and guess URLs for photos, which you might not be allowed to see. – CBroe Mar 17 '16 at 14:36
  • I understand that, and also about not being able to see photos of those your not friends with or may have as private etc, but what I mean by that, is if the urls are encrypted with extra info and decoded on the server with your cookies or jwt's etc for security? even from my example, if you have random uuid for the file names, they are not going to be guessed. Trying to understand the whole process and rationale – CaptRisky Mar 17 '16 at 15:22
  • Facebook’s CDN URLs aren’t static, they expire over time. – CBroe Mar 17 '16 at 15:43
  • How would such a setup be structured? would there be routing rules on the cdn to the actual file? and a table lookup to serve the actual file? – CaptRisky Mar 18 '16 at 02:19

0 Answers0