diff --git a/core/nginx/conf/nginx.conf b/core/nginx/conf/nginx.conf index 20cc00a6..cc011f90 100644 --- a/core/nginx/conf/nginx.conf +++ b/core/nginx/conf/nginx.conf @@ -128,30 +128,12 @@ http { include /overrides/*.conf; # Actual logic - {% if ADMIN == 'true' %} - location ^~ /ui { - include /etc/nginx/proxy.conf; - rewrite ^/ui/(.*) {{ WEB_ADMIN }}/ui/$1 redirect; - } - {% endif %} - {% if ADMIN == 'true' or WEBMAIL != 'none' %} location ^~ /sso { include /etc/nginx/proxy.conf; proxy_pass http://$admin; } - location ^~ /sso/static { - include /etc/nginx/proxy.conf; - rewrite /sso/static/(.*) /static/$1 permanent; - } - - location ^~ {{ WEB_WEBMAIL }}/sso/ui/logout { - include /etc/nginx/proxy.conf; - rewrite ^{{ WEB_WEBMAIL }}/sso/ui/logout$ /sso/logout break; - proxy_pass http://$admin; - } - location ^~ /ui/language { include /etc/nginx/proxy.conf; proxy_set_header X-Forwarded-Prefix {{ WEB_ADMIN }}; @@ -159,17 +141,17 @@ http { expires $expires; } - location ^~ /ui/webmail { + location ^~ /sso/static { include /etc/nginx/proxy.conf; - return 302 {{ WEB_WEBMAIL }}; + rewrite /sso/static/(.*) /static/$1 permanent; } - {% endif %} location ^~ /static { include /etc/nginx/proxy.conf; rewrite ^/static/(.*) /ui/static/$1 break; proxy_pass http://$admin; } + {% endif %} {% if WEB_WEBMAIL != '/' and WEBROOT_REDIRECT != 'none' %} location / { @@ -216,10 +198,26 @@ http { location @webmail_login { return 302 /sso/login?next=ui.webmail; } + + location ^~ {{ WEB_WEBMAIL }}/sso/ui/logout { + include /etc/nginx/proxy.conf; + rewrite ^{{ WEB_WEBMAIL }}/sso/ui/logout$ /sso/logout break; + proxy_pass http://$admin; + } + + location ^~ /ui/webmail { + include /etc/nginx/proxy.conf; + return 302 {{ WEB_WEBMAIL }}; + } {% else %} {% endif %} {% if ADMIN == 'true' %} + location ^~ /ui { + include /etc/nginx/proxy.conf; + rewrite ^/ui/(.*) {{ WEB_ADMIN }}/ui/$1 redirect; + } + location {{ WEB_ADMIN }} { return 301 {{ WEB_ADMIN }}/ui; }