Step 2: Specify Repositories for Direct Download
You can configure Artifactory to redirect requests for direct download at the level of repositories (there is no global configuration to automatically redirect all requests).
You can configure Artifactory to redirect requests for direct download at the level of repositories (there is no global configuration to automatically redirect all requests). This allows you to support both clients that support download redirect responses (HTTP 302) as well as those that do not.
Download redirection is supported for all repository types - local, remote, virtual, and generic repositories. For local and remote repositories configured for redirection, all requests are redirected. For virtual repositories, it depends on which aggregated local or remote repository ultimately provides the requested artifact. If that repository is configured for redirection, then the requesting client will receive the corresponding redirection response, otherwise, Artifactory will fetch the requested artifact and provide it to the client as usual without redirection.
Remote repositories must be configured to store artifacts locally
Artifactory can only redirect requests for direct cloud storage download if the requested artifact is available locally. For local repositories, this is the natural state, however, for remote repositories, you have the option to configure the repository NOT to cache artifacts locally by deselecting the Store Artifacts Locally checkbox in the Advanced tab of the repository configuration (or by setting
storeArtifactsLocally=falsewhen creating or updating the repository using REST API). Therefore, for remote repositories, you need to ensure that the repository is configured to store artifacts locally (i.e., Store Artifacts Locally checkbox is checked, orstoreArtifactsLocally=true). Failing to do so will generate an error.
You can configure Artifactory to redirect requests for direct download using the UI, REST API and YAML configuration file.
Specify Repositories for Direct Download Using the UI
To configure a local or remote repository to redirect requests for direct download, select the Enable Redirect Download checkbox in the Advanced tab of the repository configuration.
Redirect Download Requests to CDN Nodes
Use the Enable CDN Download option to direct download requests to this repository to a Cloud Storage Provider from which the artifact will be downloaded.
Specify Repositories for Direct Download Using the REST API
To configure a local or remote repository to redirect requests for direct download using the REST API, set the downloadRedirect attribute to be true (default, false). For example:
curl -u admin:password -X POST -H "Content-Type: application/json" -d '{"rclass":"local", "downloadRedirect": true}' http://localhost:8080/artifactory/api/repositories/s3-genericAlternatively, you can set the downloadRedirect parameter in the repository configuration JSON to be true.
Specify Repositories for Direct Download Using the YAML Configuration File
If you are configuring repositories using a YAML file, you can use the downloadRedirect attribute.
For example, to configure a repository called generic-remote for direct download:
curl -u admin:password -X PATCH -H "Content-Type: application/yaml" "http://localhost:8080/artifactory/api/system/configuration" -T remote.yamlwhere remote.yaml is:
remoteRepositories:
generic-remote:
downloadRedirect:
enabled: trueUpdated 5 days ago
