diff --git a/tutor/templates/local/proxy/apache2/openedx.conf b/tutor/templates/local/proxy/apache2/openedx.conf index 29c514b..b6e60ab 100644 --- a/tutor/templates/local/proxy/apache2/openedx.conf +++ b/tutor/templates/local/proxy/apache2/openedx.conf @@ -1,14 +1,17 @@ +{% if ACTIVATE_HTTPS %} - ServerName {{ LMS_HOST }} - ServerAlias preview.{{ LMS_HOST }} {{ CMS_HOST }} {% if ACTIVATE_NOTES %}notes.{{ LMS_HOST }}{% endif %} - - ProxyPreserveHost On - ProxyRequests On - ProxyPass / http://localhost:{{ NGINX_HTTP_PORT }}/ - ProxyPassReverse / http://localhost:{{ NGINX_HTTP_PORT }}/ + ServerName {{ LMS_HOST }} + Redirect / https://{{ LMS_HOST }}/ + + + ServerName preview.{{ LMS_HOST }} + Redirect / https://preview.{{ LMS_HOST }}/ + + + ServerName {{ CMS_HOST }} + Redirect / https://{{ CMS_HOST }}/ -{% if ACTIVATE_HTTPS %} ServerName {{ LMS_HOST }} ServerAlias preview.{{ LMS_HOST }} {{ CMS_HOST }} @@ -18,8 +21,14 @@ ProxyPreserveHost On ProxyRequests On - ProxyPass / http://localhost:{{ NGINX_HTTPS_PORT }}/ - ProxyPassReverse / http://localhost:{{ NGINX_HTTPS_PORT }}/ + ProxyPass / http://localhost:{{ NGINX_HTTP_PORT }}/ + ProxyPassReverse / http://localhost:{{ NGINX_HTTP_PORT }}/ + + +{% if ACTIVATE_NOTES %} + + ServerName notes.{{ LMS_HOST }} + Redirect / https://notes.{{ CMS_HOST }}/ ServerName notes.{{ LMS_HOST }} @@ -29,7 +38,18 @@ ProxyPreserveHost On ProxyRequests On - ProxyPass / http://localhost:{{ NGINX_HTTPS_PORT }}/ - ProxyPassReverse / http://localhost:{{ NGINX_HTTPS_PORT }}/ + ProxyPass / http://localhost:{{ NGINX_HTTP_PORT }}/ + ProxyPassReverse / http://localhost:{{ NGINX_HTTP_PORT }}/ + +{% endif %} +{% else %} + + ServerName {{ LMS_HOST }} + ServerAlias preview.{{ LMS_HOST }} {{ CMS_HOST }} {% if ACTIVATE_NOTES %}notes.{{ LMS_HOST }}{% endif %} + + ProxyPreserveHost On + ProxyRequests On + ProxyPass / http://localhost:{{ NGINX_HTTP_PORT }}/ + ProxyPassReverse / http://localhost:{{ NGINX_HTTP_PORT }}/ {% endif %} diff --git a/tutor/templates/local/proxy/nginx/openedx.conf b/tutor/templates/local/proxy/nginx/openedx.conf index 1673cde..dc67c5f 100644 --- a/tutor/templates/local/proxy/nginx/openedx.conf +++ b/tutor/templates/local/proxy/nginx/openedx.conf @@ -22,7 +22,7 @@ server { proxy_set_header X-Forwarded-For $remote_addr; proxy_set_header Host $http_host; proxy_redirect off; - proxy_pass http://localhost:{{ NGINX_HTTPS_PORT if ACTIVATE_HTTPS else NGINX_HTTP_PORT }}; + proxy_pass http://localhost:{{ NGINX_HTTP_PORT }}; } } @@ -43,7 +43,7 @@ server { proxy_set_header X-Forwarded-For $remote_addr; proxy_set_header Host $http_host; proxy_redirect off; - proxy_pass http://localhost:{{ NGINX_HTTPS_PORT if ACTIVATE_HTTPS else NGINX_HTTP_PORT }}; + proxy_pass http://localhost:{{ NGINX_HTTP_PORT }}; } } {% endif %}