Finishing touches. Introduce /static stub for handling all static files.

master
Dimitri Huisman 3 years ago
parent c1beee8fd7
commit 913a6304a7

@ -39,7 +39,6 @@ RUN set -eu \
&& apk del --no-cache build-dep && apk del --no-cache build-dep
COPY --from=assets static ./mailu/ui/static COPY --from=assets static ./mailu/ui/static
COPY --from=assets static ./mailu/sso/static
COPY mailu ./mailu COPY mailu ./mailu
COPY migrations ./migrations COPY migrations ./migrations
COPY start.py /start.py COPY start.py /start.py

@ -128,15 +128,6 @@ http {
include /overrides/*.conf; include /overrides/*.conf;
# Actual logic # Actual logic
location ^~ {{ WEB_ADMIN }}/sso {
include /etc/nginx/proxy.conf;
rewrite ^{{ WEB_ADMIN }}/(.*) /$1 redirect;
}
location ^~ /ui/webmail {
include /etc/nginx/proxy.conf;
return 302 {{ WEB_WEBMAIL }};
}
{% if ADMIN == 'true' %} {% if ADMIN == 'true' %}
location ^~ /ui { location ^~ /ui {
include /etc/nginx/proxy.conf; include /etc/nginx/proxy.conf;
@ -149,14 +140,31 @@ http {
include /etc/nginx/proxy.conf; include /etc/nginx/proxy.conf;
proxy_pass http://$admin; proxy_pass http://$admin;
} }
location ^~ /sso/static {
include /etc/nginx/proxy.conf;
rewrite /sso/static/(.*) /static/$1 permanent;
}
location ^~ /ui/language { location ^~ /ui/language {
include /etc/nginx/proxy.conf; include /etc/nginx/proxy.conf;
proxy_set_header X-Forwarded-Prefix {{ WEB_ADMIN }}; proxy_set_header X-Forwarded-Prefix {{ WEB_ADMIN }};
proxy_pass http://$admin; proxy_pass http://$admin;
expires $expires; expires $expires;
} }
location ^~ /ui/webmail {
include /etc/nginx/proxy.conf;
return 302 {{ WEB_WEBMAIL }};
}
{% endif %} {% endif %}
location ^~ /static {
include /etc/nginx/proxy.conf;
rewrite ^/static/(.*) /ui/static/$1 break;
proxy_pass http://$admin;
}
{% if WEB_WEBMAIL != '/' and WEBROOT_REDIRECT != 'none' %} {% if WEB_WEBMAIL != '/' and WEBROOT_REDIRECT != 'none' %}
location / { location / {
expires $expires; expires $expires;
@ -209,7 +217,7 @@ http {
return 301 {{ WEB_ADMIN }}/ui; return 301 {{ WEB_ADMIN }}/ui;
} }
location ~ {{ WEB_ADMIN }}/(ui|static) { location ~ {{ WEB_ADMIN }}/ui {
rewrite ^{{ WEB_ADMIN }}/(.*) /$1 break; rewrite ^{{ WEB_ADMIN }}/(.*) /$1 break;
include /etc/nginx/proxy.conf; include /etc/nginx/proxy.conf;
proxy_set_header X-Forwarded-Prefix {{ WEB_ADMIN }}; proxy_set_header X-Forwarded-Prefix {{ WEB_ADMIN }};
@ -217,6 +225,11 @@ http {
expires $expires; expires $expires;
} }
location ^~ {{ WEB_ADMIN }}/ui/static {
include /etc/nginx/proxy.conf;
rewrite {{ WEB_ADMIN }}/ui/static/(.*) /static/$1 permanent;
}
location {{ WEB_ADMIN }}/antispam { location {{ WEB_ADMIN }}/antispam {
rewrite ^{{ WEB_ADMIN }}/antispam/(.*) /$1 break; rewrite ^{{ WEB_ADMIN }}/antispam/(.*) /$1 break;
auth_request /internal/auth/admin; auth_request /internal/auth/admin;
@ -224,6 +237,11 @@ http {
proxy_set_header X-Forwarded-For ""; proxy_set_header X-Forwarded-For "";
proxy_pass http://$antispam; proxy_pass http://$antispam;
} }
location ^~ {{ WEB_ADMIN }}/sso {
include /etc/nginx/proxy.conf;
rewrite ^{{ WEB_ADMIN }}/(.*) /$1 redirect;
}
{% endif %} {% endif %}
{% if WEBDAV != 'none' %} {% if WEBDAV != 'none' %}

@ -2,4 +2,5 @@ Improved the SSO page.
- Now shows the login target. - Now shows the login target.
- Added toggle to choose login target. - Added toggle to choose login target.
- Made SSO page available separately. SSO page can now be used without Admin. - Made SSO page available separately. SSO page can now be used without Admin.
- Introduced stub /static which is used by all sites for accessing static files.

Loading…
Cancel
Save