diff --git a/ckan_multisite/router.py b/ckan_multisite/router.py index 0503bb9..bcc2068 100644 --- a/ckan_multisite/router.py +++ b/ckan_multisite/router.py @@ -25,6 +25,10 @@ location / {{ proxy_pass http://127.0.0.1:{site_port}; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; }} }} """ @@ -52,6 +56,10 @@ location / {{ proxy_pass http://127.0.0.1:""" + str(PORT) + """; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; }} }} """ diff --git a/ckan_multisite/task.py b/ckan_multisite/task.py index 155faa6..d8e16e0 100644 --- a/ckan_multisite/task.py +++ b/ckan_multisite/task.py @@ -3,7 +3,7 @@ """ from celery import Celery -from config import CELERY_BACKEND_URL +from config import CELERY_BACKEND_URL, HOSTNAME from router import nginx from site import site_by_name from datacats.error import WebCommandError @@ -17,7 +17,8 @@ def create_site_task(site): environment = site.environment create_environment(environment.name, None, '2.3', True, environment.site_name, False, False, - '0.0.0.0', False, True, True) + '0.0.0.0', False, True, True, + site_url='{}.{}'.format(environment.site_name, HOSTNAME)) # Serialize the site display name to its datadir site.serialize_display_name() nginx.add_site(environment.site_name, environment.port)