Monday, August 24, 2009

Drupal multi domain setup

Recently I created a Drupal multi domain site installation using Domain Access module domain-6.x-2.0-rc8.tar.gz to run an affiliated network of sites from a single Drupal installation. See

To get it working you also must change some files so it is important that you really read the README.txt and the INSTALL.txtThe only big problem where the cookies as the sites had different top level domain names.
In the config.php you needed to setup a cookie domain in a one domain Drupal configuration you can set it to the domain of the site.

In a Drupal multi site installation this gave problems. (e.g. Can not login in other domains.)
I expected that the safest way was using a special cookie domain using a crossdomain.xml
(In the README.txt and INSTALL.txt file there are also other suggestions.)

For the crossdomain cookies you need to create a crossdomain.xml file containing something like this

<?xml version="1.0"?>
<!-- -->
<allow-access-from domain="" />
<allow-access-from domain="" />
<allow-access-from domain="" />
<allow-access-from domain="" />

However, i tried this and it was not successful and I needed to try something else..

All the sites use the same IP : I did set the cookie domain to the IP address of the server.
(e.g. $cookie_domain="" ).
This worked very well.
However there are some disadvantages.

  • security: if other sites are running on the same IP
  • change of IP
    if the IP address of the server changes you need to change the configuration file.server has multiple IP
  • E.g. if the IP address of the server changes often (server in local net connected to Internet via provider and with a provider that changes often the IP.
  • if the server is known by multiple IP addresses this will not work.
    • server with multiple net interface and domains resolving to the Drupal install with different IPs
    • server in LAN that is also available by on Internet under a different IP by opening port in router.

No comments: