From c731a18f661d4c782e09104cecb3744fd023e874 Mon Sep 17 00:00:00 2001 From: Michael Kuron Date: Tue, 26 Sep 2017 22:11:01 +0200 Subject: [PATCH 1/2] =?UTF-8?q?Preliminary=20support=20for=20Outlook=20201?= =?UTF-8?q?6=E2=80=99s=20autodiscover.json?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- data/conf/nginx/site.conf | 16 ++++++++++++++++ data/web/autodiscover-json.php | 23 +++++++++++++++++++++++ 2 files changed, 39 insertions(+) create mode 100644 data/web/autodiscover-json.php diff --git a/data/conf/nginx/site.conf b/data/conf/nginx/site.conf index 5e47aa8b..1b5a8a3e 100644 --- a/data/conf/nginx/site.conf +++ b/data/conf/nginx/site.conf @@ -86,6 +86,14 @@ server { try_files /autodiscover.php =404; } + location ~* ^/Autodiscover/Autodiscover.json { + fastcgi_split_path_info ^(.+\.php)(/.+)$; + fastcgi_pass phpfpm:9000; + include /etc/nginx/fastcgi_params; + fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; + try_files /autodiscover-json.php =404; + } + location ~ /(?:m|M)ail/(?:c|C)onfig-v1.1.xml { fastcgi_split_path_info ^(.+\.php)(/.+)$; fastcgi_pass phpfpm:9000; @@ -233,6 +241,14 @@ server { try_files /autodiscover.php =404; } + location ~* ^/Autodiscover/Autodiscover.json { + fastcgi_split_path_info ^(.+\.php)(/.+)$; + fastcgi_pass phpfpm:9000; + include /etc/nginx/fastcgi_params; + fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; + try_files /autodiscover-json.php =404; + } + location ~ /(?:m|M)ail/(?:c|C)onfig-v1.1.xml { fastcgi_split_path_info ^(.+\.php)(/.+)$; fastcgi_pass phpfpm:9000; diff --git a/data/web/autodiscover-json.php b/data/web/autodiscover-json.php new file mode 100644 index 00000000..fea21593 --- /dev/null +++ b/data/web/autodiscover-json.php @@ -0,0 +1,23 @@ + \ No newline at end of file From e1ee1e848fd9afc19a0338243e6cff46a434c75e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Peters?= Date: Mon, 2 Oct 2017 23:22:53 +0200 Subject: [PATCH 2/2] Update autodiscover-json.php HTTP_HOST is okay. Syntax for consistency. :-) --- data/web/autodiscover-json.php | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/data/web/autodiscover-json.php b/data/web/autodiscover-json.php index fea21593..decfe3c3 100644 --- a/data/web/autodiscover-json.php +++ b/data/web/autodiscover-json.php @@ -8,16 +8,14 @@ if(file_exists('inc/vars.local.inc.php')) { $autodiscover_config = array_merge($default_autodiscover_config, $autodiscover_config); header('Content-type: application/json'); - -$domain_dot = strpos($_SERVER['HTTP_HOST'], '.'); -$domain = substr($_SERVER['HTTP_HOST'], $domain_dot+1); - if ($_GET['Protocol'] == 'ActiveSync') { echo '{"Protocol":"ActiveSync","Url":"' . $autodiscover_config['activesync']['url'] . '"}'; -} elseif ($_GET['Protocol'] == 'AutodiscoverV1') { - echo '{"Protocol":"AutodiscoverV1","Url":"https://autodiscover.' . $domain . '/autodiscover/autodiscover.xml"}'; -} else { +} +elseif ($_GET['Protocol'] == 'AutodiscoverV1') { + echo '{"Protocol":"AutodiscoverV1","Url":"https://' . $_SERVER['HTTP_HOST'] . '/autodiscover/autodiscover.xml"}'; +} +else { http_response_code(400); echo '{"ErrorCode":"InvalidProtocol","ErrorMessage":"The given protocol value \u0027' . $_GET['Protocol'] . '\u0027 is invalid. Supported values are \u0027ActiveSync,AutodiscoverV1\u0027"}'; } -?> \ No newline at end of file +?>