Commit 4d4a5a37 by Edward Zarecor

remote maintenance site.

parent 67269c44
......@@ -62,6 +62,13 @@ nginx_debian_pkgs:
- nginx
- python-passlib
NGINX_EDXAPP_ENABLE_S3_MAINTENANCE: False
nginx_default_error_page: "/server/server-error.html"
NGINX_EDXAPP_ERROR_PAGES:
"500": "{{ nginx_default_error_page}}"
"502": "{{ nginx_default_error_page}}"
"504": "{{ nginx_default_error_page}}"
CMS_HOSTNAME: '~^((stage|prod)-)?studio.*'
nginx_template_dir: "edx/app/nginx/sites-available"
......
......@@ -13,8 +13,22 @@ upstream cms-backend {
server {
# CMS configuration file for nginx, templated by ansible
# 500 error pages
error_page 500 502 504 /server/server-error.html;
# Proxy to a remote maintanence page
{% if NGINX_EDXAPP_ENABLE_S3_MAINTENANCE %}
# Do not include a 502 error in NGINX_ERROR_PAGES when
# NGINX_EDXAPP_ENABLE_S3_MAINTENANCE is enabled.
error_page 502 @maintenance;
{% include "s3_maintenance.j2" %}
{% endif %}
# error pages
{% for k, v in NGINX_EDXAPP_ERROR_PAGES.iteritems() %}
error_page {{ k }} {{ v }};
{% endfor %}
{% if NGINX_ENABLE_SSL %}
......
......@@ -18,8 +18,22 @@ limit_req_zone $cookie_{{ EDXAPP_SESSION_COOKIE_NAME }} zone=cookies:10m rate={{
server {
# LMS configuration file for nginx, templated by ansible
# 500 error pages
error_page 500 502 504 /server/server-error.html;
{% if NGINX_EDXAPP_ENABLE_S3_MAINTENANCE %}
# Do not include a 502 error in NGINX_ERROR_PAGES when
# NGINX_EDXAPP_ENABLE_MAINTENANCE is enabled.
error_page 502 @maintenance;
{% include "s3_maintenance.j2" %}
{% endif %}
# error pages
{% for k, v in NGINX_EDXAPP_ERROR_PAGES.iteritems() %}
error_page {{ k }} {{ v }};
{% endfor %}
{% if NGINX_ENABLE_SSL %}
......
{% if NGINX_EDXAPP_ENABLE_S3_MAINTENANCE %}
location @maintenance {
rewrite ^(.*) {{ NGINX_EDXAPP_S3_MAINTENANCE_FILE }} break;
proxy_http_version 1.1;
proxy_set_header Host s3.amazonaws.com;
proxy_set_header Authorization '';
proxy_hide_header x-amz-id-2;
proxy_hide_header x-amz-request-id;
proxy_hide_header Set-Cookie;
proxy_ignore_headers "Set-Cookie";
proxy_buffering off;
proxy_intercept_errors on;
proxy_pass https://s3.amazonaws.com;
}
{% endif %}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment