Skip to content

Commit

Permalink
Forward the details of a request on via Nginx and make sure we're usi…
Browse files Browse the repository at this point in the history
…ng the right site_url
  • Loading branch information
JackMc committed Sep 30, 2015
1 parent ca84e62 commit 13f0073
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
8 changes: 8 additions & 0 deletions ckan_multisite/router.py
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}}
}}
"""
Expand Down Expand Up @@ -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;
}}
}}
"""
Expand Down
5 changes: 3 additions & 2 deletions ckan_multisite/task.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
Expand Down

0 comments on commit 13f0073

Please sign in to comment.