Understanding the Cause
When attempting to update a repository's configuration in Artifactory, users might encounter a validation error: "Failed to update repository [repository_name]: Found config violations: publicAppContext should not be blank".
This error is triggered by a validation introduced in Artifactory version 7.104.5 and later, which mandates that the publicAppContext property in the Global Configuration Descriptor cannot be blank.
The publicAppContext property is integral to how Artifactory generates URLs, especially in environments utilizing a reverse proxy. While its default value in new installations is artifactory, it's possible for this property to be blank in older instances. This typically occurs because Artifactory 6.x's UI allowed the "Public Context Path" field to be left empty, and this null value then persisted in the database during subsequent upgrades.
How to Resolve the Error
To fix this validation error, you need to explicitly set the publicAppContext property to artifactory in your Global Configuration Descriptor.
Method 1: Update the Configuration via Apply Artifactory YAML Configuration Changes REST API - Recommended for Helm/HA Installations
1. Navigate to the Artifactory UI Administration -> Artifactory Settings -> Config Descriptor page. Identify the current reverseProxies.reverseProxy.key. This step is crucial before proceeding to step 2:
2. Prepare the configuration.yml file with the change as follows. This is where we must specify the correct key, in this case its “direct”:
reverseProxies:
direct:
publicAppContext: "artifactory" 3. Execute the command:
curl -u admin:password -X PATCH "http://<JFROG_HOST>/artifactory/api/system/configuration" -H "Content-Type: application/yaml" -T configuration.yml
Method 2: Using the Artifactory UI - Recommended for Single Node Installations
4. Navigate to the Artifactory UI Administration -> Artifactory Settings -> Config Descriptor page.
5. Find the reverseProxies.reverseProxy.publicAppContext. If it's blank, enter artifactory:
6. Click "Save" to apply the configuration update.
Alternative Methods: The following documentation provide steps for alternative methods:
1. Modifying Configuration Using the REST API
2. Bootstrapping the Global Configuration
3. Bootstrap the Artifactory Configuration in Helm Installs
Configuration Persistence
Once the configuration has been updated via the UI or REST API, the changes are written directly into Artifactory's central database. This means the updated settings persist across restarts and will be retained as the active configuration.
To validate, run the Retrieving and Setting the Global Configuration Descriptor REST API:
curl -u admin:password "https://<JFROG_HOST>/artifactory/api/system/configuration" | grep "publicAppContext"