Open cmagnuson opened 12 years ago
I've fixed this by looking up the url from the list based on the hashed value of the resource (this way each resource is served by a single URL, loading it again will not result in a cache miss).
if( !url ){ int cdnNum = getHashedResourceNum(resource.linkUrl, mergedConfig.url.size()); url = mergedConfig.url[cdnNum] }
private int getHashedResourceNum(String toHash, int maxNum){ if(toHash.contains('/')){ toHash = toHash.substring(toHash.lastIndexOf('/')); } return toHash.hashCode() % (maxNum+1); }
It would be helpful to allow a list of CDN urls to be entered, so that file requests can be paralleled over multiple hostnames.
grails.resources.cdn.url = ["http://resources1.xyz.com", "http://resources2.xyz.com", "http://resources3.xyz.com""]