Home > Mobile >  REST API and CDN for audio streaming
REST API and CDN for audio streaming

Time:08-10

I'm facing a bandwith issue on a server that hosts a REST API and I wondered if I could use a CDN to fix it.

Most of the bandwith consumption is due to static assets provision, like audio files.

Access to those assets requires an authentication token (JWT like). When the user requests for an asset, I first need the API to do some checkups, and then streams an audio file.

A CDN appeared to me as an ideal solution, but it raised two questions :

  • Can I keep my static audios behind a JWT authentication if they are stored on a CDN ?
  • Is it possible to redirect the original request to a dynamic link provided by the CDN, and specifically ask for streaming and not raw download ?

Thanks for your time and advices

CodePudding user response:

If you want basic API authentication for CDN request then most CDN's support mechanism to do this - for example the Akamai information is here:

Answering the second question, so long as the CDN and your client support range requests then you should be able to download chunks, if you are using basic HTTP progressive download type streaming.

If you are using HLS or DASH streaming then nearly all CDN's will support this as standard.

  • Related