PHPackages                             pantheon-systems/pantheon\_domain\_masking - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. pantheon-systems/pantheon\_domain\_masking

ActiveDrupal-module[Utility &amp; Helpers](/categories/utility)

pantheon-systems/pantheon\_domain\_masking
==========================================

Domain masking middleware for Drupal

2.1.1(2mo ago)12285.9k↓11.5%6[2 issues](https://github.com/pantheon-systems/pantheon_domain_masking/issues)[3 PRs](https://github.com/pantheon-systems/pantheon_domain_masking/pulls)GPL-2.0+PHPCI passing

Since Feb 18Pushed 2mo ago32 watchersCompare

[ Source](https://github.com/pantheon-systems/pantheon_domain_masking)[ Packagist](https://packagist.org/packages/pantheon-systems/pantheon_domain_masking)[ Docs](https://github.com/pantheon-systems/pantheon_domain_masking)[ RSS](/packages/pantheon-systems-pantheon-domain-masking/feed)WikiDiscussions 2.x Synced 1mo ago

READMEChangelog (5)Dependencies (4)Versions (15)Used By (0)

Pantheon Domain Masking
=======================

[](#pantheon-domain-masking)

[![Unofficial](https://camo.githubusercontent.com/0e6eb84a3bab07531499291d7a1b139de0a3703ec1d135302451ae252e439b02/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f50616e7468656f6e2d556e6f6666696369616c2d79656c6c6f773f6c6f676f3d70616e7468656f6e26636f6c6f723d464644433238)](https://pantheon.io/docs/oss-support-levels#unofficial)

This module allows domain masking in Drupal for environments where Drupal is not running under Apache, or where the hosting configuration is unavailable.

Typically domain masking can be facilitated by adding a few lines to a `.htaccess` or `nginx.conf` file; however, if that method is unavailable, this module allows Drupal to be aware of changes to the host and to persist those changes when generating redirects.

Installing the module
---------------------

[](#installing-the-module)

The module can be installed by downloading this module and placing directly in `modules/contrib` (or wherever you have decided to store modules in your filesystem). You can also [install via composer](https://getcomposer.org/doc/05-repositories.md#loading-a-package-from-a-vcs-repository) by running:

```
composer require pantheon-systems/pantheon_domain_masking

```

Enabling and Configuring the module
-----------------------------------

[](#enabling-and-configuring-the-module)

Once the module has been installed to the filesystem, it can be enabled like any other contrib module. However, this will not enable the domain masking functionality. Once the module is active, the config page for the module (`/admin/config/pantheon-domain-masking/options`) will allow you to enter the public-facing domain name. You will need to toggle the `Enable domain masking?` field on this page to enable the middleware.

Alternatively, you may configure the module in your `settings.php` file (or another file imported by `settings.php`) by using Drupal's [Configuration Override System](https://www.drupal.org/docs/drupal-apis/configuration-api/configuration-override-system). Specify values in `settings.php` like this:

```
$config['pantheon_domain_masking.settings']['domain'] = 'foo.com';
$config['pantheon_domain_masking.settings']['subpath'] = 'bar';

```

When you load [the configuration page](/admin/config/pantheon-domain-masking/options) you'll find that the options you set in `settings.php` appear in the form and that the form inputs are disabled.

### Available Config Overrides

[](#available-config-overrides)

- `domain`: The public facing domain.
- `subpath`: The subpath for Drupal. DO NOT include the leading `/`.
- `allow_platform`: Allow platform access.

### Cache Context

[](#cache-context)

If `allow_platform` is enabled, you will need to add `url.site` in `renderer.config.required_cache_context` (located in `sites/default/services.yml`) to prevent cache primed in platform domain to be served in public facing domain and vice versa.

```
  renderer.config:
    # Renderer required cache contexts:
    #
    # The Renderer will automatically associate these cache contexts with every
    # render array, hence varying every render array by these cache contexts.
    #
    # @default ['languages:language_interface', 'theme', 'user.permissions']
    required_cache_contexts: ['url.site', 'languages:language_interface', 'theme', 'user.permissions']

```

### Example

[](#example)

Assume a site is running on Pantheon with a live environment address of `https://live-example.pantheonsite.io`. Assume the public-facing domain you wish to use is `https://www.example.com`. In this case, you would enter `www.example.com` in the `Public-facing domain:` field. Once the `Enable domain masking?` field is set to `Yes`, Drupal will use `www.example.com` in generating any internal redirects.

Allowing platform access
------------------------

[](#allowing-platform-access)

Under normal circumstances, this module will force all requests to use the masked domain. However, if you wish to access this site via Pantheon's platform domain (ending in `.pantheonsite.io`) without going through the masked domain, set the `Allow Platform domain access?` field to `Yes`.

### Example

[](#example-1)

Following the example above, suppose the public-facing domain was masking two different Pantheon environments, eg. `https://live-example-a.pantheonsite.io` and `https://live-example-b.pantheonsite.io`. Navigating to `https://www.example.com/user/login` would resolve to whatever backend the edge server chose for that request and, depending on the configuration (eg. round-robin) may not be consistent from request to request. In order to manage both the `A` and `B` sites directly, the `Allow Platform domain access?` field would need to be set to `Yes` on both sites, and content managers would need to access `https://live-example-a.pantheonsite.io/user/login` or `https://live-example-b.pantheonsite.io/user/login` directly to manage those specific instances.

###  Health Score

55

—

FairBetter than 98% of packages

Maintenance83

Actively maintained with recent releases

Popularity45

Moderate usage in the ecosystem

Community28

Small or concentrated contributor base

Maturity56

Maturing project, gaining track record

 Bus Factor2

2 contributors hold 50%+ of commits

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~185 days

Recently: every ~302 days

Total

9

Last Release

67d ago

Major Versions

1.x-dev → 2.0.02022-11-21

### Community

Maintainers

![](https://www.gravatar.com/avatar/b34cc6bd882277b6c6dda19bf6631ae5c3a909fd667c826a15121642cdc051b2?d=identicon)[greg.1.anderson](/maintainers/greg.1.anderson)

![](https://www.gravatar.com/avatar/5a89f5f15357797cbd6ec7833a28626478ae3c0ceb5fa1faa8a26d0960584c65?d=identicon)[pantheon-systems](/maintainers/pantheon-systems)

![](https://www.gravatar.com/avatar/e1afabee581deb6161002f5f479e52610b94e544938f335b1dd6f2dd6e40d678?d=identicon)[namespacebrian](/maintainers/namespacebrian)

![](https://www.gravatar.com/avatar/d26ed2d0c89d83cd16a881c549b14ebccddc1e8db00a9077d687177134dd4bf8?d=identicon)[pantheon-ci-bot](/maintainers/pantheon-ci-bot)

![](https://avatars.githubusercontent.com/u/8427313?v=4)[EL Abquina](/maintainers/eabquina)[@eabquina](https://github.com/eabquina)

---

Top Contributors

[![tmountjr](https://avatars.githubusercontent.com/u/1203675?v=4)](https://github.com/tmountjr "tmountjr (21 commits)")[![kporras07](https://avatars.githubusercontent.com/u/2217820?v=4)](https://github.com/kporras07 "kporras07 (15 commits)")[![rkunjappan](https://avatars.githubusercontent.com/u/210441229?v=4)](https://github.com/rkunjappan "rkunjappan (13 commits)")[![greg-1-anderson](https://avatars.githubusercontent.com/u/612191?v=4)](https://github.com/greg-1-anderson "greg-1-anderson (4 commits)")[![eabquina](https://avatars.githubusercontent.com/u/8427313?v=4)](https://github.com/eabquina "eabquina (4 commits)")[![stovak](https://avatars.githubusercontent.com/u/119924?v=4)](https://github.com/stovak "stovak (3 commits)")[![marfillaster](https://avatars.githubusercontent.com/u/121793?v=4)](https://github.com/marfillaster "marfillaster (3 commits)")[![adskbradb](https://avatars.githubusercontent.com/u/143109453?v=4)](https://github.com/adskbradb "adskbradb (2 commits)")[![szipfel](https://avatars.githubusercontent.com/u/856298?v=4)](https://github.com/szipfel "szipfel (2 commits)")[![pwtyler](https://avatars.githubusercontent.com/u/8714062?v=4)](https://github.com/pwtyler "pwtyler (1 commits)")[![namespacebrian](https://avatars.githubusercontent.com/u/87093053?v=4)](https://github.com/namespacebrian "namespacebrian (1 commits)")[![jrearick-pfg](https://avatars.githubusercontent.com/u/79481644?v=4)](https://github.com/jrearick-pfg "jrearick-pfg (1 commits)")[![chx](https://avatars.githubusercontent.com/u/193045?v=4)](https://github.com/chx "chx (1 commits)")[![nullvariable](https://avatars.githubusercontent.com/u/171515?v=4)](https://github.com/nullvariable "nullvariable (1 commits)")

---

Tags

drupal

###  Code Quality

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/pantheon-systems-pantheon-domain-masking/health.svg)

```
[![Health](https://phpackages.com/badges/pantheon-systems-pantheon-domain-masking/health.svg)](https://phpackages.com/packages/pantheon-systems-pantheon-domain-masking)
```

###  Alternatives

[lullabot/amp

A set of useful classes and utilities to convert html to AMP html (See https://www.ampproject.org/)

3802.9M10](/packages/lullabot-amp)[drupal/core-composer-scaffold

A flexible Composer project scaffold builder.

5341.9M446](/packages/drupal-core-composer-scaffold)[drupal/core-project-message

Adds a message after Composer installation.

2122.6M172](/packages/drupal-core-project-message)[aleksip/plugin-data-transform

Data Transform Plugin for Pattern Lab PHP

34897.4k3](/packages/aleksip-plugin-data-transform)[acquia/drupal-recommended-settings

The composer plugin for adding drupal-recommended-settings for Acquia Cloud.

101.1M4](/packages/acquia-drupal-recommended-settings)[tripal/tripal

Tripal is a toolkit to facilitate construction of online genomic, genetic (and other biological) websites.

709.9k9](/packages/tripal-tripal)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
