Skip to content

Commit

Permalink
Merge pull request #36 from datacats/34-data-uploads
Browse files Browse the repository at this point in the history
Forward the details of a request on via Nginx and make sure we're using the right site url
  • Loading branch information
JackMc committed Nov 5, 2015
2 parents dff2434 + 13f0073 commit e19d7c7
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 e19d7c7

Please sign in to comment.