From 5bedcc1cb1a0e2e3922136102b730f3681577486 Mon Sep 17 00:00:00 2001 From: Dimitri Huisman Date: Tue, 14 Dec 2021 15:10:28 +0000 Subject: [PATCH 1/2] Fix #2078 --- core/nginx/conf/nginx.conf | 7 ++++++- towncrier/newsfragments/2078.fix | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 towncrier/newsfragments/2078.fix diff --git a/core/nginx/conf/nginx.conf b/core/nginx/conf/nginx.conf index 71cbf9ee..c9e21fb3 100644 --- a/core/nginx/conf/nginx.conf +++ b/core/nginx/conf/nginx.conf @@ -135,7 +135,7 @@ http { # Actual logic {% if ADMIN == 'true' or WEBMAIL != 'none' %} - location ~ ^/(sso|static) { + location ~ ^/(sso|static)/ { include /etc/nginx/proxy.conf; proxy_pass http://$admin; } @@ -165,7 +165,12 @@ http { proxy_pass http://$webmail; } + {% if WEB_WEBMAIL == '/' %} + location /sso.php { + {% endif %} + {% if WEB_WEBMAIL != '/' %} location {{ WEB_WEBMAIL }}/sso.php { + {% endif %} {% if WEB_WEBMAIL != '/' %} rewrite ^({{ WEB_WEBMAIL }})$ $1/ permanent; rewrite ^{{ WEB_WEBMAIL }}/(.*) /$1 break; diff --git a/towncrier/newsfragments/2078.fix b/towncrier/newsfragments/2078.fix new file mode 100644 index 00000000..2a05e5f4 --- /dev/null +++ b/towncrier/newsfragments/2078.fix @@ -0,0 +1 @@ +SSO login page to webmail did not work if WEB_WEBMAIL=/ was set. \ No newline at end of file From d7a8235b892dfa1408e5004b689bee5f23c58a1f Mon Sep 17 00:00:00 2001 From: Florent Daigniere Date: Wed, 15 Dec 2021 10:53:47 +0100 Subject: [PATCH 2/2] Simplify --- core/nginx/conf/nginx.conf | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/core/nginx/conf/nginx.conf b/core/nginx/conf/nginx.conf index c9e21fb3..2f5f3496 100644 --- a/core/nginx/conf/nginx.conf +++ b/core/nginx/conf/nginx.conf @@ -167,8 +167,7 @@ http { {% if WEB_WEBMAIL == '/' %} location /sso.php { - {% endif %} - {% if WEB_WEBMAIL != '/' %} + {% else %} location {{ WEB_WEBMAIL }}/sso.php { {% endif %} {% if WEB_WEBMAIL != '/' %}