Domain Masquerade
No security coverage
Domain ecosystem
This module allows administrators and content managers to temporarily view the site as if they were visiting from a different domain, without changing the browser's URL. It's useful for previewing domain-specific content, testing access controls, or demonstrating how the site appears on different domains.
Features
Basic Functionality
Domain Masquerade enables administrators and content managers to temporarily "switch" to viewing the site as if they were visiting from a different domain, all while staying on the current URL. The active domain context changes but the browser's address bar remains unchanged.
Unique Features
- Session-based domain switching - The masquerade state persists across page loads within your browser session
- Domain Switcher block - A ready-to-use block displays all active domains as clickable links
- Admin route protection - Administration pages always use the real domain to prevent accidental configuration issues
- Automatic validation - Invalid masquerade states (deleted or disabled domains) are automatically cleared
- Decorator pattern integration - Seamlessly integrates with Domain module's negotiator service
Use Cases
- Content Management: Preview domain-specific content, blocks, and menu items without leaving your current domain
- QA Testing: Verify domain-based access controls and visibility rules in a single browser session
- Development: Debug multi-domain issues without switching browser profiles or hosts files
- Training: Demonstrate how the site appears to visitors on different domains
Post-Installation
- Configure permissions at
/admin/people/permissions:- Grant the "Masquerade as any domain" permission to trusted roles (administrators, content managers). This permission is marked as restricted for
security.
- Grant the "Masquerade as any domain" permission to trusted roles (administrators, content managers). This permission is marked as restricted for
- Place the Domain Masquerade Switcher block:
- Navigate to
/admin/structure/block - Find the "Domain Masquerade Switcher" block and place it in a visible region (toolbar, sidebar, etc.)
- The block only appears to users with the masquerade permission
- Navigate to
- Using the switcher:
- Click any domain name in the block to view the site as that domain
- The currently active domain is shown in bold
- Click "Clear masquerade" to return to the real domain based on your URL
No configuration page is required—the module works immediately after enabling and placing the block.
Additional Requirements
- Drupal core: 10.3 or higher, or Drupal 11
- Domain module: Required for multi-domain functionality