ARTIFACTORY: How to Fix a Corrupted ‘URL to File’ Value

Sam Rosenstein
2022-09-14 15:37

Each artifact stored in Artifactory contains a list of general information. One of these items is the ‘URL to file’ property which is the URL pointing to the file location. The value of this URL stems from the Artifactory custom base URL

In certain cases, the value of the ‘URL to file’ value can become corrupted due to misconfiguration on the reverse proxy side of things. For example, the value may have the following format:

  • http://:443/reponame/path/to/file
  • http:///reponame/path/to/file

In order to solve this, we need to ensure that the reverse proxy correctly bases the base URL to Artifactory. Please see the following for examples of this for both Apache and NGINX. 
 

NGINX

Artifactory 6x:proxy_set_header    X-Artifactory-Override-Base-Url
$http_x_forwarded_proto://$host:$server_port/artifactory;

Artifactory 7x:proxy_set_header    X-JFrog-Override-Base-Url
$http_x_forwarded_proto://$host:$server_port;
 

Apache

If the desired custom base URL has a value of BASE_URL, use the following lines:

Artifactory 6x:RequestHeader set X-Artifactory-Override-Base-Url
​​​​​​​%{my_scheme}e://BASE_URL:%{my_server_port}e/artifactory

Artifactory 7x:RequestHeader set X-JFrog-Override-Base-Url
​​​​​​​%{my_scheme}e://BASE_URL:%{my_server_port}e