Commit 62e77eff authored by Jérome Perrin's avatar Jérome Perrin

fixup! slaprunner: fix 401 http errors when no account exist

Redirect in nginx does not behave the same depending on wether it is
accessed directly or behind apache proxy.
parent e53b8e86
......@@ -102,7 +102,7 @@ mode = 0644
recipe = hexagonit.recipe.download
url = ${:_profile_base_location_}/nginx_conf.in
download-only = true
md5sum = fac41d8819c17ebca78e4554932b1075
md5sum = 5bbe62827d232b3bbac3d5eb03e2d648
filename = nginx_conf.in
mode = 0644
......
......@@ -36,6 +36,17 @@ http {
location / {
# When no .htpasswd exist, redirect the user to account creation page
if ( !-f {{ param_nginx_frontend['etc_dir'] }}/.htpasswd ) {
# redirect URL is different wether nginx is accessed directly or behind apache.
# nginx does not support nested if or multiple conditions, so we use this well known hack.
set $test no_htpasswd;
}
if ( $host = [{{ param_nginx_frontend['global-ip'] }}] ) {
set $test "${test}_backend_access";
}
if ( $test = no_htpasswd) {
return 301 $scheme://$host/setAccount ;
}
if ( $test = no_htpasswd_backend_access) {
return 301 /setAccount ;
}
auth_basic "Restricted";
......
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