diff --git a/omeroweb/templates/nginx-development.conf.template b/omeroweb/templates/nginx-development.conf.template index 75dafb63a0..504c414426 100644 --- a/omeroweb/templates/nginx-development.conf.template +++ b/omeroweb/templates/nginx-development.conf.template @@ -33,6 +33,7 @@ http { sendfile on; client_max_body_size %(MAX_BODY_SIZE)s; + error_page 502 =502 @maintenance%(PREFIX_NAME)s; %(NGINX_SERVER_EXTRA_CONFIG)s @@ -59,7 +60,6 @@ http { location %(FORCE_SCRIPT_NAME)s { - error_page 502 @maintenance%(PREFIX_NAME)s; # checks for static file, if not found proxy to app try_files $uri @proxy_to_app%(PREFIX_NAME)s; } diff --git a/omeroweb/templates/nginx-location.conf.template b/omeroweb/templates/nginx-location.conf.template index 8a2018dfbe..bda38ef2fe 100644 --- a/omeroweb/templates/nginx-location.conf.template +++ b/omeroweb/templates/nginx-location.conf.template @@ -26,6 +26,7 @@ location %(STATIC_URL)s { } location @proxy_to_app%(PREFIX_NAME)s { + error_page 502 =502 @maintenance%(PREFIX_NAME)s; proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $http_host; @@ -37,7 +38,7 @@ location @proxy_to_app%(PREFIX_NAME)s { location %(FORCE_SCRIPT_NAME)s { - error_page 502 @maintenance%(PREFIX_NAME)s; + error_page 502 =502 @maintenance%(PREFIX_NAME)s; # checks for static file, if not found proxy to app try_files $uri @proxy_to_app%(PREFIX_NAME)s; } diff --git a/omeroweb/templates/nginx.conf.template b/omeroweb/templates/nginx.conf.template index b9350515d4..7ff31cd58a 100644 --- a/omeroweb/templates/nginx.conf.template +++ b/omeroweb/templates/nginx.conf.template @@ -8,6 +8,7 @@ server { sendfile on; client_max_body_size %(MAX_BODY_SIZE)s; + error_page 502 =502 @maintenance%(PREFIX_NAME)s; %(NGINX_SERVER_EXTRA_CONFIG)s @@ -34,7 +35,6 @@ server { location %(FORCE_SCRIPT_NAME)s { - error_page 502 @maintenance%(PREFIX_NAME)s; # checks for static file, if not found proxy to app try_files $uri @proxy_to_app%(PREFIX_NAME)s; } diff --git a/test/unit/reference_templates/nginx-development-withoptions.conf b/test/unit/reference_templates/nginx-development-withoptions.conf index de1293a700..8ee1f5198f 100644 --- a/test/unit/reference_templates/nginx-development-withoptions.conf +++ b/test/unit/reference_templates/nginx-development-withoptions.conf @@ -33,6 +33,7 @@ http { sendfile on; client_max_body_size 2m; + error_page 502 =502 @maintenance_test; # <<<<< omero.web.nginx_server_extra_config listen 443 ssl; @@ -63,7 +64,6 @@ ssl_certificate_key /dummy/private.key; location /test { - error_page 502 @maintenance_test; # checks for static file, if not found proxy to app try_files $uri @proxy_to_app_test; } diff --git a/test/unit/reference_templates/nginx-development.conf b/test/unit/reference_templates/nginx-development.conf index e7599da4f1..af0590e8d7 100644 --- a/test/unit/reference_templates/nginx-development.conf +++ b/test/unit/reference_templates/nginx-development.conf @@ -33,6 +33,7 @@ http { sendfile on; client_max_body_size 0; + error_page 502 =502 @maintenance; @@ -59,7 +60,6 @@ http { location / { - error_page 502 @maintenance; # checks for static file, if not found proxy to app try_files $uri @proxy_to_app; } diff --git a/test/unit/reference_templates/nginx-location-withoptions.conf b/test/unit/reference_templates/nginx-location-withoptions.conf index 7b6907e101..cd668746f2 100644 --- a/test/unit/reference_templates/nginx-location-withoptions.conf +++ b/test/unit/reference_templates/nginx-location-withoptions.conf @@ -26,6 +26,7 @@ location /test-static { } location @proxy_to_app_test { + error_page 502 =502 @maintenance_test; proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $http_host; @@ -37,7 +38,7 @@ location @proxy_to_app_test { location /test { - error_page 502 @maintenance_test; + error_page 502 =502 @maintenance_test; # checks for static file, if not found proxy to app try_files $uri @proxy_to_app_test; } diff --git a/test/unit/reference_templates/nginx-location.conf b/test/unit/reference_templates/nginx-location.conf index ed47f43598..c6be915b19 100644 --- a/test/unit/reference_templates/nginx-location.conf +++ b/test/unit/reference_templates/nginx-location.conf @@ -26,6 +26,7 @@ location /static { } location @proxy_to_app { + error_page 502 =502 @maintenance; proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $http_host; @@ -37,7 +38,7 @@ location @proxy_to_app { location / { - error_page 502 @maintenance; + error_page 502 =502 @maintenance; # checks for static file, if not found proxy to app try_files $uri @proxy_to_app; } diff --git a/test/unit/reference_templates/nginx-withoptions.conf b/test/unit/reference_templates/nginx-withoptions.conf index 0d208dd8dd..3b14f59272 100644 --- a/test/unit/reference_templates/nginx-withoptions.conf +++ b/test/unit/reference_templates/nginx-withoptions.conf @@ -8,6 +8,7 @@ server { sendfile on; client_max_body_size 2m; + error_page 502 =502 @maintenance_test; # <<<<< omero.web.nginx_server_extra_config listen 443 ssl; @@ -38,7 +39,6 @@ ssl_certificate_key /dummy/private.key; location /test { - error_page 502 @maintenance_test; # checks for static file, if not found proxy to app try_files $uri @proxy_to_app_test; } diff --git a/test/unit/reference_templates/nginx.conf b/test/unit/reference_templates/nginx.conf index e41ec5e43f..86c74e6d51 100644 --- a/test/unit/reference_templates/nginx.conf +++ b/test/unit/reference_templates/nginx.conf @@ -8,6 +8,7 @@ server { sendfile on; client_max_body_size 0; + error_page 502 =502 @maintenance; @@ -34,7 +35,6 @@ server { location / { - error_page 502 @maintenance; # checks for static file, if not found proxy to app try_files $uri @proxy_to_app; } diff --git a/test/unit/test_web.py b/test/unit/test_web.py index bfb1a7894d..193b27f9ba 100644 --- a/test/unit/test_web.py +++ b/test/unit/test_web.py @@ -159,6 +159,7 @@ def normalise_generated(self, s): def compare_with_reference(self, refname, generated): reffile = path(__file__).dirname() / "reference_templates" / refname generated = generated.split("\n") + # Temporarily uncomment the following line to regenerate the templates # reffile.write_lines(generated) ref = reffile.lines(retain=False) d = "\n".join(unified_diff(ref, generated))