maandag 24 augustus 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 http://drupal.org/project/domain

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"?>
<!-- http://www.a.com/crossdomain.xml -->
<cross-domain-policy>
<allow-access-from domain="www.a.com" />
<allow-access-from domain="www2.a.com" />
<allow-access-from domain="www.b.com" />
<allow-access-from domain="www.c.net" />
</cross-domain-policy>


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="1.2.3.4" ).
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.
    Examples
    • 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.

Geen opmerkingen: