virepo
virepo

Reputation: 330

Amazon CloudFront , server EC2 & S3 files together

I have a Cross-origin resource sharing on my web application. I'm trying to create a virtual reality 360-degree video website, but on safari/iPhone it fails because of CORS. For some reason, safari/ios doesn't support CORS on WebGL which runs the VR.

If my files were all in my EC2 instance, it would work fine as they come from the same origin, however, because I have my web app files on EC2, and my assets on S3 its causing an issue.

To get around this I have been told I can use Amazons CloudFront, to effectively serve files from my EC2, and S3 bucket but make it look like it's from the same origin to the browser. This would then bypass the CORS error I'm getting and run normally.

However I cannot work out how to do this, could someone please explain how I would do this in CloudFront?

Thanks

Upvotes: 1

Views: 299

Answers (1)

Piyush Patil
Piyush Patil

Reputation: 14523

For achieving your use case you will have to set up a AWS Cloud Front distribution with multiple origin. Follow this developer guide that is the best one.

http://www.bucketexplorer.com/documentation/amazon-s3--how-to-create-distributions-post-distribution-with-multiple-origin-servers.html

Upvotes: 1

Related Questions