Restrict Umbraco backoffice access to a domain
$ dotnet add package Umbraco.Community.DomainRestrictionUmbraco package that allows to restrict domain-based access to the backoffice.
nuget.org/packages/Umbraco.Community.DomainRestriction
marketplace.umbraco.com/category/developer-tools
Step 1: Under appsettings, create a section called "DomainRestriction", with:
Enabled, which enables the domain restrictionUmbracoDomain, the only allowed domain to access the backofficeUmbracoPath, which will have a default value of "/umbraco"RedirectUrl, which will have a default value of "/error-404". if left empty it will return a 404 error."DomainRestriction": {
"Enabled": true,
"UmbracoPath": "/umbraco",
"UmbracoDomain": "https://localhost:4000",
"RedirectUrl": "/error-404"
}
Step 2: In the web-project Startup.cs file:
using Umbraco.Community.DomainRestriction.Extensions;
...
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
...
app.UseDomainRestriction();
...
}
When the client domain is forbidden, the system will return a blank page. You can set up the page that the user will see following this docs: