diff --git a/slapos/recipe/erp5_bootstrap/__init__.py b/slapos/recipe/erp5_bootstrap/__init__.py
index f6f1a99dc68da6bc38ed26212788b4673d57ab80..934b6419f77c4fc632663bfb94289513b6fded90 100644
--- a/slapos/recipe/erp5_bootstrap/__init__.py
+++ b/slapos/recipe/erp5_bootstrap/__init__.py
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2012 Vifib SARL and Contributors. All Rights Reserved.
+# Copyright (c) 2012-2014 Vifib SARL and Contributors. All Rights Reserved.
 #
 # WARNING: This program as such is intended to be used by professional
 # programmers who take the whole responsibility of assessing all potential
@@ -26,7 +26,6 @@
 ##############################################################################
 
 from slapos.recipe.librecipe import GenericBaseRecipe
-import os
 import sys
 import urlparse
 
@@ -36,31 +35,25 @@ class Recipe(GenericBaseRecipe):
   """
 
   def install(self):
-    parsed = urlparse.urlparse(self.options['mysql-url'])
-    mysql_connection_string = "%(database)s@%(hostname)s:%(port)s "\
-        "%(username)s %(password)s" % dict(
-      database=parsed.path.split('/')[1],
-      hostname=parsed.hostname,
-      port=parsed.port,
-      username=parsed.username,
-      password=parsed.password
-    )
-
-    zope_parsed = urlparse.urlparse(self.options['zope-url'])
-
-    config = dict(
-      python_path=sys.executable,
-      user=zope_parsed.username,
-      password=zope_parsed.password,
-      site_id=zope_parsed.path.split('/')[1],
-      host="%s:%s" % (zope_parsed.hostname, zope_parsed.port),
-      sql_connection_string=mysql_connection_string,
-    )
-
-    # Runners
-    runner_path = self.createExecutable(
+    mysql = urlparse.urlsplit(self.options['mysql-url'])
+    zope = urlparse.urlsplit(self.options['zope-url'])
+    # Note: raises when there is more than a single element in path, as it's
+    # not supported by manage_addERP5Site anyway.
+    _, zope_path = zope.path.split('/')
+    return [self.createExecutable(
       self.options['runner-path'],
-      self.substituteTemplate(self.getTemplateFilename('erp5_bootstrap.in'),
-                              config))
-
-    return [runner_path]
+      self.substituteTemplate(
+        self.getTemplateFilename('erp5_bootstrap.in'),
+        {
+          'python_path': sys.executable,
+          'base_url': urlparse.urlunsplit((zope.scheme, zope.netloc, '', '', '')),
+          'site_id': zope_path,
+          'sql_connection_string': '%(database)s@%(hostname)s:%(port)s %(username)s %(password)s' % {
+            'database': mysql.path.split('/')[1],
+            'hostname': mysql.hostname,
+            'port': mysql.port,
+            'username': mysql.username,
+            'password': mysql.password
+          },
+        },
+    ))]
diff --git a/slapos/recipe/erp5_bootstrap/template/erp5_bootstrap.in b/slapos/recipe/erp5_bootstrap/template/erp5_bootstrap.in
index b7a36bf328d99048d8c5a8f25a3ab01bed8369be..4f2e189a690e846845efcb093a152a9b3cbcc4d1 100644
--- a/slapos/recipe/erp5_bootstrap/template/erp5_bootstrap.in
+++ b/slapos/recipe/erp5_bootstrap/template/erp5_bootstrap.in
@@ -1,46 +1,22 @@
 #!%(python_path)s
-
-import httplib
 import urllib
-import base64
-
-user = "%(user)s"
-password = "%(password)s"
-host = "%(host)s"
-site_id = "%(site_id)s"
-erp5_catalog_storage = 'erp5_mysql_innodb_catalog'
-mysql_url = "%(sql_connection_string)s"
-
-header_dict = {'Authorization': 'Basic %%s' %% \
-  base64.encodestring('%%s:%%s' %% (user, password)).strip(),
-               'Referer':'http://%%s/manage_addProduct/ERP5/addERP5Site' %% host}
-zope_connection = httplib.HTTPConnection(host)
-
-# Check if an ERP5 site is already created, as ERP5 does support having
-# 2 instances in the same zope, and this script should not destroy user data
-zope_connection.request('GET', '/isERP5SitePresent', headers=header_dict)
-result = zope_connection.getresponse()
 
-if result.status == 204: # and (result.read() == "False"):
-
-  # Use a new connection
-  zope_connection = httplib.HTTPConnection(host)
-
-  # Create the expected ERP5 instance
-  zope_connection.request(
-    'POST', '/manage_addProduct/ERP5/manage_addERP5Site',
-    urllib.urlencode({
-      'id': site_id,
-      'erp5_catalog_storage': erp5_catalog_storage,
+def isSuccess(response):
+  return 200 <= response.code < 300
+
+base_url = %(base_url)r
+response = urllib.urlopen(base_url + '/isERP5SitePresent')
+if isSuccess(response) and response.read() == '':
+  mysql_url = %(sql_connection_string)r
+  response = urllib.urlopen(
+    base_url + '/manage_addProduct/ERP5/manage_addERP5Site',
+    data=urllib.urlencode({
+      'id': %(site_id)r,
+      'erp5_catalog_storage': 'erp5_mysql_innodb_catalog',
       'erp5_sql_connection_string': mysql_url,
       'cmf_activity_sql_connection_string': mysql_url,
     }),
-    headers=header_dict)
-  # Wait for the erp5 response, to prevent multiple requests
-  # been done by the same script.
-  result = zope_connection.getresponse()
-
-  # Read result make sure the site really finished to 
-  #created the ERP5 site.
-  result.read()
+  )
+  if not isSuccess(response):
+    raise ValueError('Failed creating site, status=%%i: %%s' %% (response.code, response.read()))
   print "ERP5 site created."