search_api_solr_proxy
Search API Solr Proxy allows multiple Drupal sites to share a single Pantheon-hosted Solr search server via an authenticated HTTP proxy, removing the need for each site to maintain its own dedicated Solr instance.
Out of the box, Pantheon provides one Solr server per site. If you run a network of Drupal sites on Pantheon and want unified, cross-site search — or simply want to centralize Solr management — this module enables a "hub and spoke" model: one site owns and exposes the Solr server (the hub), and every other site connects to it as a client through an authenticated proxy.
This package ships as a lightweight framework module with one included submodule:
- search_api_solr_proxy — The base module. Provides an abstract
SolrProxyConnectorBaseplugin class that handles all proxy plumbing (URL rewriting, authentication header injection, PSR-18 compatibility). Not useful on its own, but easy to extend for any custom proxy hub. - search_api_solr_proxy_pantheon_connector — The ready-to-use submodule for Pantheon-hosted hub sites. Install this on each client site to connect it to a hub running the companion Pantheon Solr API module.
Features
- Hub-and-spoke Solr sharing — One Pantheon Solr server serves any number of client Drupal sites without each needing its own Solr instance.
- Authenticated proxy — All Solr traffic is authenticated via a shared API key sent as an
X-Pantheon-Solr-KeyHTTP header, ensuring only authorized client sites can query the hub. - Fast SELECT path — Search (SELECT) queries are routed to a standalone PHP script on the hub (
pantheon-solr-proxy.php) that bypasses the full Drupal bootstrap, keeping search response times low. - Automatic URL rewriting — A Guzzle middleware transparently rewrites outbound Solr request URLs, so Search API Solr continues to work without any changes to its internals.
- PSR-18 & redirect compatibility — Solarium requires a strict PSR-18 HTTP client. The base class includes a custom adapter that correctly follows Pantheon CDN redirects, which PSR-18 forbids natively.
- Schema management on the hub — Solr schema changes are always applied on the hub with a single
drush sapi-pccommand. Schema check warnings on client sites are suppressed automatically. - Client registration — A Drush command (
drush pantheon-solr-proxy:register) registers a client site with the hub, allowing hub administrators to track all connected sites. - Extensible base class —
SolrProxyConnectorBasecan be subclassed to build connectors for any custom proxy hub beyond Pantheon.
Post-Installation
This module works as part of a two-module setup. The hub site runs the Pantheon Solr API module. Each client site runs the submodule included here: search_api_solr_proxy_pantheon_connector.
On each client site:
- Require and enable the submodule:
composer require drupal/key && drush en search_api_solr_proxy_pantheon_connector -y && drush cr - Store the shared API key as a Pantheon organization secret (set once for the whole org):
terminus secret:org:set {your-org-id} PANTHEON_SOLR_API_KEY {key} --scope=web --type=runtime - Create a Key entity at /admin/config/system/keys with provider set to Pantheon Secret and secret name
PANTHEON_SOLR_API_KEY. - Go to /admin/config/search/search-api → Add server → Backend: Solr → Solr Connector: Pantheon Solr Proxy. Enter the hub site URL and select the Key entity created above.
- Register this client with the hub:
drush pantheon-solr-proxy:register - Create a Search API index attached to the new server, configure your fields, and index your content:
drush search-api:index
Schema errors shown by Search API Solr on client sites are expected and safe to ignore. The schema is managed exclusively on the hub.
Additional Requirements
Base module (search_api_solr_proxy):
- Drupal 10.2 or 11
- Search API Solr ^4.3
Pantheon Connector submodule (search_api_solr_proxy_pantheon_connector):
- All of the above
- Key (for storing the API key as a Drupal entity)
- Pantheon Secrets (for reading the key from Pantheon's secrets store)
- Terminus with the Secrets Manager Plugin (for setting the org-level secret)
Hub site:
- Pantheon Solr API — must be installed on the hub site. This is the companion module that exposes the Solr proxy endpoint.
- Solr 8 enabled in the hub site's
pantheon.yml.
Recommended modules/libraries
- Search API — The foundation for all search functionality in Drupal. Required by Search API Solr.
- Facets — Add faceted filtering to your search results pages.
- Search API Autocomplete — Provide real-time search suggestions powered by the shared Solr index.
Similar projects
- Search API Solr — The core Search API backend for Solr. This module extends it rather than replacing it; you still need Search API Solr installed.
- Search API Solr Multisite — An approach included in Search API Solr that allows a single Solr core to serve multiple Drupal sites. Unlike this module, the multisite approach requires each site to connect to Solr directly, which is not possible when Solr is locked to a single Pantheon environment's network.
Supporting this Module
This module is developed and maintained by Aten Design Group. If you find it useful, consider supporting open-source Drupal development.
Community Documentation
- Full setup instructions are available in the module's
README.mdfiles, included in the repository. - Hub site setup is documented in the companion Pantheon Solr API module.