This project is not covered by Drupal’s security advisory policy.
This module allows sites protected by the require login module (8.x-1.12 or greater) to select which domain names to require users to login to and which can allow anonymous access.
A couple of use cases for this are:
Edit Security
In this case, the public site (www.example.com) should be accessible via anonymous access but not allow user login or other admin access.
Admin access should only be allowed via edit.example.com, a separate DNS entry that points to the same site. Access to the site via this domain should require users to login first. No anonymous access.
To secure the www site, you can use an .htaccess like the one below:
# Deny admin requests for www.example.com and example.com
RewriteCond %{HTTP_HOST} ^(www.example.com|example.com) [NC]
RewriteCond %{REQUEST_URI} ^(/..|/..-..)?/user$ [OR]
RewriteCond %{REQUEST_URI} ^(/..|/..-..)?/user/.* [OR]
RewriteCond %{REQUEST_URI} ^(/..|/..-..)?/admin$ [OR]
RewriteCond %{REQUEST_URI} ^(/..|/..-..)?/admin/.* [OR]
RewriteCond %{REQUEST_URI} ^(/..|/..-..)?/devel/.* [OR]
RewriteCond %{REQUEST_URI} ^(/..|/..-..)?/taxonomy/term/.*/.* [OR]
RewriteCond %{REQUEST_URI} ^(/..|/..-..)?/node/.*/.*
RewriteRule ^ - [L,R=404]
To provide edit access and require login, you need to install the require login module and this module.
On the /admin/config/people/require-login/by-site configuration page:
- Enable the filter
- Select a Filter Type of: Allow Anonymous Access for the Domains Below
- Enter the domains (one per line): www.example.com example.com
Now request like www.example.com/user/login or www.example.com/node/1/edit will receive a 404 error. Other pages that anonymous users have normal access to (e.g. any published page) can be seen.
People going to edit.example.com will be required to login in order to see anything.
Intranet / External Access
In this case, you want people on the Intranet to access the site without logging in but want require login if they are coming in from the internet.
Basically, this is the same as above. Have an external DNS entry (e.g. external.example.com => extranet IP) and an internal DNS entry (e.g. internal.example.com => intranet IP like 10.10.1.1). Use the filter to require login from the external.example.com domain.
NOTE:
In order to see the "sites" tab on the Required Login page, you must apply to patch in #2976926: Enable Translation Tab / Ability to add other task tabs. Without this, you will have to manually got to /admin/config/people/require-login/by-site (or just add /by-site to the require login admin page) to get to the configuration page.
Admin Toolbar users can access it thru the Config -> People -> Require Login -> Sites menu dropdown.
Project information
Seeking new maintainer
The current maintainers are looking for new people to take ownership.- Project categories: Administration tools, Security, Access control
2 sites report using this module
- Created by cgmonroe on , updated
This project is not covered by the security advisory policy.
Use at your own risk! It may have publicly disclosed vulnerabilities.

