1
0
mirror of https://github.com/Mailu/Mailu.git synced 2024-12-12 10:45:38 +02:00

Add json redirect

This commit is contained in:
Florent Daigniere 2022-03-15 10:26:29 +01:00
parent 9a2d8d63a3
commit 184c9bc566
3 changed files with 16 additions and 1 deletions

View File

@ -40,6 +40,16 @@ def autoconfig_mozilla():
</clientConfig>\r\n''' </clientConfig>\r\n'''
return flask.Response(xml, mimetype='text/xml', status=200) return flask.Response(xml, mimetype='text/xml', status=200)
@internal.route("/autoconfig/microsoft.json")
def autoconfig_microsoft_json():
proto = flask.request.args.get('Protocol', 'Autodiscoverv1')
if proto == 'Autodiscoverv1':
hostname = app.config['HOSTNAME']
json = f'{"Protocol":"Autodiscoverv1","Url":"https://{hostname}/autodiscover/autodiscover.xml"}'
return flask.Response(json, mimetype='application/json', status=200)
else
return flask.abort(404)
@internal.route("/autoconfig/microsoft", methods=['GET', 'POST']) @internal.route("/autoconfig/microsoft", methods=['GET', 'POST'])
def autoconfig_microsoft(): def autoconfig_microsoft():
# https://docs.microsoft.com/en-us/previous-versions/office/office-2010/cc511507(v=office.14)?redirectedfrom=MSDN#Anchor_3 # https://docs.microsoft.com/en-us/previous-versions/office/office-2010/cc511507(v=office.14)?redirectedfrom=MSDN#Anchor_3

View File

@ -127,6 +127,11 @@ http {
proxy_pass http://$admin; proxy_pass http://$admin;
} }
# microsoft autoconfiguration # microsoft autoconfiguration
location ~* ^/Autodiscover/Autodiscover.json {
rewrite ^ /internal/autoconfig/microsoft.json break;
include /etc/nginx/proxy.conf;
proxy_pass http://$admin;
}
location ~* ^/Autodiscover/Autodiscover.xml { location ~* ^/Autodiscover/Autodiscover.xml {
rewrite ^ /internal/autoconfig/microsoft break; rewrite ^ /internal/autoconfig/microsoft break;
include /etc/nginx/proxy.conf; include /etc/nginx/proxy.conf;

View File

@ -66,7 +66,7 @@ Because the admin interface is served as ``/admin``, the Webmail as ``/webmail``
server { server {
# [...] here goes your standard configuration # [...] here goes your standard configuration
location ~* ^/(admin|sso|static|webdav|webmail|(apple\.)?mobileconfig|(\.well\-known/autoconfig/)?mail/|Autodiscover/Autodiscover.xml) { location ~* ^/(admin|sso|static|webdav|webmail|(apple\.)?mobileconfig|(\.well\-known/autoconfig/)?mail/|Autodiscover/Autodiscover) {
proxy_set_header Host $host; proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr proxy_set_header X-Real-IP $remote_addr
proxy_pass https://localhost:8443; proxy_pass https://localhost:8443;