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

Changes to nginx @maintenance handler #168

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
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
2 changes: 1 addition & 1 deletion omeroweb/templates/nginx-development.conf.template
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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;
}
Expand Down
3 changes: 2 additions & 1 deletion omeroweb/templates/nginx-location.conf.template
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
}
2 changes: 1 addition & 1 deletion omeroweb/templates/nginx.conf.template
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion test/unit/reference_templates/nginx-development.conf
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ http {

sendfile on;
client_max_body_size 0;
error_page 502 =502 @maintenance;



Expand All @@ -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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
}
Expand Down
3 changes: 2 additions & 1 deletion test/unit/reference_templates/nginx-location.conf
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion test/unit/reference_templates/nginx-withoptions.conf
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion test/unit/reference_templates/nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ server {

sendfile on;
client_max_body_size 0;
error_page 502 =502 @maintenance;



Expand All @@ -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;
}
Expand Down
1 change: 1 addition & 0 deletions test/unit/test_web.py
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
Loading