ARTIFACTORY: CDN redirect in JFrog Cloud
Users will be able to manage, control, and distribute large volumes of software across multiple locations using the CDN feature. There are two types of redirects in Artifactory that help in the faster download of packages. Depending on the configuration, any packages larger than 200KB will be redirected to one of the following:
- S3 redirect
- CDN redirect
The S3 redirect is the default redirect that is enabled for all SaaS servers with AWS as the cloud provider. This feature is supported on the Cloud (SaaS) platform, with an Enterprise X or Enterprise+ license.
The CDN feature (Enable CDN Download) needs to be enabled at the repository level, it can be enabled in 2 ways:
1. UI: from the advanced tab under the repository configuration as shown below:
2. Using the Update Repository REST API: In the JSON when running the REST add this additional field: "cdnRedirect": true
Full example below:
{
"key":"test-nuget-local",
"packageType":"nuget",
"description":"",
"notes":"",
"includesPattern":"**/*",
"excludesPattern":"",
"repoLayoutRef":"simple-default",
"enableComposerSupport":false,
"enableNuGetSupport":false,
"enableGemsSupport":false,
"enableNpmSupport":false,
"enableBowerSupport":false,
"enableCocoaPodsSupport":false,
"enableConanSupport":false,
"enableDebianSupport":false,
"debianTrivialLayout":false,
"enablePypiSupport":false,
"enablePuppetSupport":false,
"enableDockerSupport":false,
"dockerApiVersion":"V2",
"blockPushingSchema1":true,
"forceNugetAuthentication":false,
"enableVagrantSupport":false,
"enableGitLfsSupport":false,
"enableDistRepoSupport":false,
"checksumPolicyType":"client-checksums",
"handleReleases":true,
"handleSnapshots":true,
"maxUniqueSnapshots":0,
"maxUniqueTags":0,
"snapshotVersionBehavior":"unique",
"suppressPomConsistencyChecks":true,
"blackedOut":false,
"propertySets":[
"artifactory"
],
"archiveBrowsingEnabled":false,
"calculateYumMetadata":false,
"enableFileListsIndexing":false,
"yumRootDepth":0,
"downloadRedirect":false,
"cdnRedirect":true,
"xrayIndex":false,
"enabledChefSupport":false,
"rclass":"local"
}
CDN feature Workflow:When Artifactory receives a download artifact request from the user, then Artifactory returns a redirected CDN URL to the user. The user's redirected download request is automatically routed to the nearest CDN and the requested package is served to the user from the nearest CDN location.
For any packages below the 200KB size or Without the CDN feature then the user requests for the package to Artifactory reaches Artifactory and the package will be served from the Binarystore that is configured in Artifactory.
In the artifactory-request.log, we will see the requests as following:
For file greater than 200KB
2022-06-07T20:18:13.431Z|33a46490202bc00e|52.9.243.19|divija|GET|/generic-local-test/Filename.tgz|302|-1|0|87|curl/7.77.0
For file less than 200KB
2022-06-07T20:17:46.085Z|b29a371e79e558e1|52.9.243.19|divija|GET|/generic-local-test/smallFilename2.tgz|200|-1|174080|216|curl/7.77.0
When the CDN redirect or S3 redirect is enabled, the requested artifacts will be served from the S3 or CloudFront domains instead of Artifactory domain. In the redirect response that Artifactory provides the CDN and the S3 domains are constant, whereby adding them to the organization’s firewall will ensure smooth and uninterrupted downloads of artifacts.
For CloudFront:
https://<cloudFrontDomainName>.cloudfront.net/…
Example Cloudfront URL looks similar to:
https://d3bszrh4vo52dt.cloudfront.net/filestore/……
For S3:
https://<bucketName>.s3.amazonaws.com/…
Example S3 redirect URL looks similar to :
https://<bucketName>.s3.amazonaws.com/aol-lookout/filestore/bc
Please note that with CDN/S3 redirect enabled, when downloading artifacts from different clients, the Client must follow the redirects in order to download successfully.