Use Aws S3 and cloudfront now.
S3 private content.
How to set the referer of the cloudfront url?
I'm not sure i understand the question, but you probably want to use "signed urls" and/or "origin access identity" instead of referer header:
See doc: http://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/PrivateContent.html