code: private void setCorsPolicy(String bucketName, List<String> allowedOrigins, String dcHost) {
          // If list is null or empty, add a default value
          if (null == allowedOrigins || allowedOrigins.isEmpty()) {
              allowedOrigins = new ArrayList<>();
              allowedOrigins.add("https://*");
          } else { // If list is not empty, append DuraCloud host to allow streaming via DurAdmin
              allowedOrigins.add("https://" + dcHost);
          }
  
          List<CORSRule> corsRules = new ArrayList<>();
  
          for (String allowedOrigin : allowedOrigins) {
              CORSRule corsRule = new CORSRule();
              corsRule.setAllowedOrigins(allowedOrigin);
              corsRule.setAllowedMethods(CORSRule.AllowedMethods.GET, CORSRule.AllowedMethods.HEAD);
              corsRule.setMaxAgeSeconds(3000);
              corsRule.setAllowedHeaders("*");
              corsRules.add(corsRule);
          }
  
          BucketCrossOriginConfiguration corsConfig =
              new BucketCrossOriginConfiguration().withRules(corsRules);
  
          s3Client.setBucketCrossOriginConfiguration(bucketName, corsConfig);
      }
docs: /*
  Sets CORS policy on the bucket. This policy will be served through
  CloudFront (based on forwarding rules) to allow cross-region requests
  to be made by JavaScript wanting to stream content from CloudFront