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, String[] allowedOrigins, CORSRule.AllowedMethods[] allowedMethods, String[] exposedHeaders, int maxAgeSeconds ){ System.out.println("================ CREATE RULE ================ "); CORSRule rule ...