Umbraco package that allows to restrict domain-based access to the backoffice.
nuget.org/packages/Umbraco.Community.DomainRestriction
marketplace.umbraco.com/package/umbraco.community.domainrestriction
Step 1: Under appsettings, create a section called "DomainRestriction", with:
- bool
Enabled
, which enables the domain restriction - string
UmbracoDomain
, the only allowed domain to access the backoffice - string
UmbracoPath
, which will have a default value of"/umbraco"
- string
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: