Drush site-install with Domain 7.x-3.x

One of the projects that I am working on uses the Domain Access module. Yesterday I updated the version from domain-7.x-2.x to domain-7.x-3.x in the project's drush make file, and after doing a make and site-install the site failed to load.

There was no error during the make or site-install, but a 'drush status' command issued after the site-install reported the following two errors.

WD domain: Domain access failed to load during phase: 1.
Please checkyour settings.php file and site configuration.
WD domain: Invalid domain requested by Anonymous on ; redirected to

After some research, including determining that the {domain} table had 0 records, and looking at the domain_install() function in domain.install, I figured out that no default (primary) domain was created on install. On install the domain module will create a default (primary) domain. The domain that is used is parsed from the $_SERVER['HTTP_HOST'] variable.

When running drush without the --uri option the $_SERVER['HTTP_HOST'} variable is not set, therefore no default domain is created and the site will fail to load.

The solution is simple, invoke the drush site-install with the --uri option specifying the domain that you wish to be default (e.g. --uri=localhost, or --uri=example.com).