6
0
mirror of https://github.com/ChristianLight/tutor.git synced 2024-12-12 14:17:46 +00:00

Fix incorrect web proxy redirect

With WEB_PROXY=true, web server only listens on NGINX_HTTP_PORT.
This commit is contained in:
Régis Behmo 2019-03-23 14:19:51 -07:00
parent 76f9f5bb97
commit d6a40c681d
2 changed files with 34 additions and 14 deletions

View File

@ -1,14 +1,17 @@
{% if ACTIVATE_HTTPS %}
<VirtualHost *:80>
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 }}/
Redirect / https://{{ LMS_HOST }}/
</VirtualHost>
<VirtualHost *:80>
ServerName preview.{{ LMS_HOST }}
Redirect / https://preview.{{ LMS_HOST }}/
</VirtualHost>
<VirtualHost *:80>
ServerName {{ CMS_HOST }}
Redirect / https://{{ CMS_HOST }}/
</VirtualHost>
{% if ACTIVATE_HTTPS %}
<VirtualHost *:443>
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 }}/
</VirtualHost>
{% if ACTIVATE_NOTES %}
<VirtualHost *:80>
ServerName notes.{{ LMS_HOST }}
Redirect / https://notes.{{ CMS_HOST }}/
</VirtualHost>
<VirtualHost *:443>
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 }}/
</VirtualHost>
{% endif %}
{% else %}
<VirtualHost *:80>
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 }}/
</VirtualHost>
{% endif %}

View File

@ -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 %}