Cross-origin Resource Sharing

Cross-origin Resource Sharing (CORS) is used for sharing resources between different domains. We can use the resources of one domain in another domain by keeping the CORS support enabled. CORS is achieved by creating rules and assigning those rules to the bucket.

First of all, we need to create CORSRule:

.... CORSRule.AllowedMethods[] allowedMethods1 = new CORSRule.AllowedMethods[] {CORSRule.AllowedMethods.GET, CORSRule.AllowedMethods.PUT, CORSRule.AllowedMethods.POST, CORSRule.AllowedMethods.DELETE}; String[] allowedOrigins1 = new String[] {"http://*.sunilgulabani.com"}; CORSRule rule1 = createRule("Sunil Gulabani Website Rule",allowedOrigins1,allowedMethods1,null,-1); .... private CORSRule createRule( String id, ...

Get Amazon S3 Essentials now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.