Configure Licenses
Commercial Umbraco products require a valid license to run in production environments. This article covers how to install, configure, and validate licenses for Umbraco's commercial products.
Product-Specific License Information
For product-specific information including what a license covers, pricing, and how to purchase:
Installing Your License
Umbraco commercial products use configuration-based licenses. These are installed by adding your license key to the appsettings.json file.
For version 14 and above, licenses are configured under Umbraco:Licenses:Products:
Open the root directory for your project.
Locate and open the
appsettings.jsonfile.Add your license key to
Umbraco:Licenses:Products:<ProductName>:
{
"Umbraco": {
"Licenses": {
"Products": {
"Umbraco.Commerce": "YOUR_LICENSE_KEY",
"Umbraco.Deploy.OnPrem": "YOUR_LICENSE_KEY",
"Umbraco.Engage": "YOUR_LICENSE_KEY",
"Umbraco.Forms": "YOUR_LICENSE_KEY",
"Umbraco.UIBuilder": "YOUR_LICENSE_KEY",
"Umbraco.Workflow": "YOUR_LICENSE_KEY"
}
}
}
}For versions 10-13, licenses are configured under Umbraco:Licenses:
Open the root directory for your project files.
Locate and open the
appsettings.jsonfile.Add your license key to
Umbraco:Licenses:<ProductName>:
{
"Umbraco": {
"Licenses": {
"Umbraco.Commerce": "YOUR_LICENSE_KEY",
"Umbraco.Deploy.OnPrem": "YOUR_LICENSE_KEY",
"Umbraco.Engage": "YOUR_LICENSE_KEY",
"Umbraco.Forms": "YOUR_LICENSE_KEY",
"Umbraco.UIBuilder": "YOUR_LICENSE_KEY",
"Umbraco.Workflow": "YOUR_LICENSE_KEY"
}
}
}Verifying the License Installation
You can verify that your license is successfully installed by logging into your project's backoffice:
Navigate to the Settings section.
Look for the Licenses dashboard.
Verify the license status displayed on the dashboard.
The dashboard will show the status of all installed commercial product licenses.
Configuring UmbracoApplicationUrl
The website domain used for validating the license is determined from your Umbraco instance. To ensure the correct one is used, you can configure the UmbracoApplicationUrl.
When to Configure UmbracoApplicationUrl
If you are running on a single domain for both your frontend and backend environments, it's not necessary to configure a UmbracoApplicationUrl.
If you have different domains for your frontend and backend, then it's advised that you configure an UmbracoApplicationUrl set to your backoffice URL. This helps the licensing engine know which URL should be used for validation checks. Without this configuration setting, the licensing engine will try and work out the domain to validate from the HTTP request object. This can lead to errors when switching between domains.
How to Configure UmbracoApplicationUrl
An UmbracoApplicationUrl can be configured in your appsettings.json file:
{
"Umbraco": {
"CMS": {
"WebRouting": {
"UmbracoApplicationUrl": "https://admin.my-custom-domain.com/"
}
}
}
}See the Fixed Application URL documentation for more details about this setting.
Configuring UmbracoApplicationUrl on Umbraco Cloud
If you are hosting on Umbraco Cloud, you will find that the configuration described above won't be reflected in your environment. The reason for this is that Umbraco Cloud sets this value as an environment variable set to the Cloud project domain (<your project>.umbraco.io). This overrides what is set via the appsettings.json file.
There are two options in this case:
Either the domains for each of your Cloud environments can be added to your license.
Or, for more control and to ensure this value is set correctly for other reasons, you can apply the configuration via code.
For example, in your Program.cs:
builder.Services.Configure<WebRoutingSettings>(o => o.UmbracoApplicationUrl = "<your application URL>");In practice, you may want to make this configuration more flexible. You can read the value from another configuration key, removing the need to hard-code it and have it set as appropriate in different environments. You can also move this code into a composer or an extension method if you prefer not to clutter up the Program.cs file.
Validating a License Without an Outgoing Internet Connection
Some Umbraco installations will have a highly locked down production environment, with firewall rules that prevent outgoing HTTP requests. This will interfere with the normal process of license validation.
On start-up, and periodically whilst Umbraco is running, the license component will make an HTTP POST request to https://license-validation.umbraco.com/api/ValidateLicense.
If it's possible to do so, the firewall rules should be adjusted to allow this request.
If such a change is not feasible, there is another approach you can use.
Setting Up License Relay
You will need to have a server, or serverless function, that is running and can make a request to the online license validation service. That needs to run on a daily schedule, making a request and relaying it onto the restricted Umbraco environment.
Configure a random string as an authorization key in configuration. This is used as protection to ensure only valid requests are handled. You can also disable the normal regular license checks - as there is no point in these running if they will be blocked:
{
"Umbraco": {
"Licenses": {
"Products": {
"Umbraco.Commerce": "<your license key>"
},
"EnableScheduledValidation": false,
"ValidatedLicenseRelayAuthKey": "<your authorization key>"
}
}
}Ensure you use the latest product version, so the package dependency on Umbraco.Licenses is updated to 13.1.0 or later.
{
"Umbraco": {
"Licenses": {
"Umbraco.Commerce": "<your license key>"
},
"LicensesOptions": {
"EnableScheduledValidation": false,
"ValidatedLicenseRelayAuthKey": "<your authorization key>"
}
}
}Your Internet-enabled server should make a request of the following form to the online license validation service:
POST https://license-validation.umbraco.com/api/ValidateLicense
{
"ProductId": "Umbraco.Commerce",
"LicenseKey": "<your license key>",
"Domain": "<your licensed domain>"
}The response should be relayed exactly via an HTTP request to your restricted Umbraco environment:
POST http://<your umbraco environment>/umbraco/licenses/validatedLicense/relay?productId=<product id>&licenseKey=<license key>A header with a key of X-AUTH-KEY and the value of the authorization key you have configured should be provided.
This will trigger the same processes that occur when the normal scheduled validation completes ensuring your product is considered licensed.
Last updated
Was this helpful?