Umbraco.Community.DomainRestriction 1.0.1

dotnet add package Umbraco.Community.DomainRestriction --version 1.0.1                
NuGet\Install-Package Umbraco.Community.DomainRestriction -Version 1.0.1                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Umbraco.Community.DomainRestriction" Version="1.0.1" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Umbraco.Community.DomainRestriction --version 1.0.1                
#r "nuget: Umbraco.Community.DomainRestriction, 1.0.1"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Umbraco.Community.DomainRestriction as a Cake Addin
#addin nuget:?package=Umbraco.Community.DomainRestriction&version=1.0.1

// Install Umbraco.Community.DomainRestriction as a Cake Tool
#tool nuget:?package=Umbraco.Community.DomainRestriction&version=1.0.1                

Domain Restriction For Umbraco Backoffice

Umbraco package that allows to restrict domain-based access to the backoffice.

Installation

Nuget

nuget.org/packages/Umbraco.Community.DomainRestriction

Umbraco Package

marketplace.umbraco.com/category/developer-tools

Configuration

Appsettings

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"
}

Startup

Step 2: In the web-project Startup.cs file:

using Umbraco.Community.DomainRestriction.Extensions;
...
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
	...
	app.UseDomainRestriction();
	...
}
Dealing with the 403 code

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:

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.1 96 9/18/2024