Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Forward the details of a request on via Nginx and make sure we're using the right site url #36

Merged
merged 1 commit into from
Nov 5, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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