You are here

DOMAINS.txt in Acquia Purge 6

Domain detection
================================================================================

Whenever Acquia Purge tries to wipe pages (e.g. "news" or "<front>") from your
site it has to reconstruct URLs and determine which domains associated to your
site should be cleaned. On most simple Drupal sites running on Acquia Cloud it
will be immediately adequate and it will just purge your primary domain name.

However, it is often necessary to tell Acquia Purge what domains it should wipe
as the automatically detected list grows too large. This often happens with
multi-site setups or single sites with many aliased domain names. To protect
your site and servers you should aim to purge no more than 1-4 domains,
but the module will self-shutdown whenever it detects more then 8 domains.

How domain detection works
--------------------------------------------------------------------------------
The module does a good job in detecting 80% of the right domains and performs a
series of checks and tests automatically. To better understand what data it uses
to determine the domains its good to know what things it checks:

1. Take all hardcoded domains in $conf['acquia_purge_domains'] and stop finding.

If not overridden the automatic detection starts:
2. Take the current HTTP_HOST the user is using to visit the site.
3. Interpret the domain name found in $base_url when it is different.
4. Add all domains on the "Domains" page of the Acquia Cloud subscription.

Listing the domains
--------------------------------------------------------------------------------
You can easily list the domains that will be purged using "drush ap-domains"
or its alias "drush apdo". When you didn't hardcode domains in settings.php, the
detection will use environment parameters. Therefore its important to always
pass --uri to Drush to simulate real-world usage:

  $ drush ap-domains --uri="http://www.site.com"
  www.site.com

Overriding/hardcoding domains
--------------------------------------------------------------------------------
Whenever the domains aren't right, put this in settings.php:

/**
 * Override domain detection in Acquia Purge.
 */
if (isset($_ENV['AH_SITE_ENVIRONMENT'])) {
  if ($_ENV['AH_SITE_ENVIRONMENT'] == 'prod') {
    $conf['acquia_purge_domains'] = array(
      'www.site.com',
      'www.site.nl',
      'www.site.de',
    );
  }
}

How to purge domain access and simple multi-site sites?
--------------------------------------------------------------------------------
The Domain Access module isn't officially supported yet, although it is on our
roadmap. However, you can make it work fairly easily by taking the "incoming"
host name in the URL and assuming that to be the right (and only) domain to be
purged. This will also work for simple multi-sites but it is of importance to
test every individual site using the "drush ap-domains" command (with --uri).

/**
 * Override domain detection in Acquia Purge: hardcode the incoming domain.
 */
if (isset($_SERVER['HTTP_HOST']) && (!empty($_SERVER['HTTP_HOST']))) {
  $conf['acquia_purge_domains'] = array($_SERVER['HTTP_HOST']);
}

File

DOMAINS.txt
View source
  1. Domain detection
  2. ================================================================================
  3. Whenever Acquia Purge tries to wipe pages (e.g. "news" or "") from your
  4. site it has to reconstruct URLs and determine which domains associated to your
  5. site should be cleaned. On most simple Drupal sites running on Acquia Cloud it
  6. will be immediately adequate and it will just purge your primary domain name.
  7. However, it is often necessary to tell Acquia Purge what domains it should wipe
  8. as the automatically detected list grows too large. This often happens with
  9. multi-site setups or single sites with many aliased domain names. To protect
  10. your site and servers you should aim to purge no more than 1-4 domains,
  11. but the module will self-shutdown whenever it detects more then 8 domains.
  12. How domain detection works
  13. --------------------------------------------------------------------------------
  14. The module does a good job in detecting 80% of the right domains and performs a
  15. series of checks and tests automatically. To better understand what data it uses
  16. to determine the domains its good to know what things it checks:
  17. 1. Take all hardcoded domains in $conf['acquia_purge_domains'] and stop finding.
  18. If not overridden the automatic detection starts:
  19. 2. Take the current HTTP_HOST the user is using to visit the site.
  20. 3. Interpret the domain name found in $base_url when it is different.
  21. 4. Add all domains on the "Domains" page of the Acquia Cloud subscription.
  22. Listing the domains
  23. --------------------------------------------------------------------------------
  24. You can easily list the domains that will be purged using "drush ap-domains"
  25. or its alias "drush apdo". When you didn't hardcode domains in settings.php, the
  26. detection will use environment parameters. Therefore its important to always
  27. pass --uri to Drush to simulate real-world usage:
  28. $ drush ap-domains --uri="http://www.site.com"
  29. www.site.com
  30. Overriding/hardcoding domains
  31. --------------------------------------------------------------------------------
  32. Whenever the domains aren't right, put this in settings.php:
  33. /**
  34. * Override domain detection in Acquia Purge.
  35. */
  36. if (isset($_ENV['AH_SITE_ENVIRONMENT'])) {
  37. if ($_ENV['AH_SITE_ENVIRONMENT'] == 'prod') {
  38. $conf['acquia_purge_domains'] = array(
  39. 'www.site.com',
  40. 'www.site.nl',
  41. 'www.site.de',
  42. );
  43. }
  44. }
  45. How to purge domain access and simple multi-site sites?
  46. --------------------------------------------------------------------------------
  47. The Domain Access module isn't officially supported yet, although it is on our
  48. roadmap. However, you can make it work fairly easily by taking the "incoming"
  49. host name in the URL and assuming that to be the right (and only) domain to be
  50. purged. This will also work for simple multi-sites but it is of importance to
  51. test every individual site using the "drush ap-domains" command (with --uri).
  52. /**
  53. * Override domain detection in Acquia Purge: hardcode the incoming domain.
  54. */
  55. if (isset($_SERVER['HTTP_HOST']) && (!empty($_SERVER['HTTP_HOST']))) {
  56. $conf['acquia_purge_domains'] = array($_SERVER['HTTP_HOST']);
  57. }