aboutsummaryrefslogtreecommitdiff
path: root/php/outlook.php
diff options
context:
space:
mode:
authorAdam Spragg <adam@spra.gg>2021-10-04 16:34:05 +0100
committerAdam Spragg <adam@spra.gg>2021-10-04 16:34:05 +0100
commitf0915858de8ca06ee63296b5259e84c5a2713f1b (patch)
tree02411c4f77815e262f557141686cf5618fa18abd /php/outlook.php
parentedf137a7d0a15f5b63f50392aad9927f043bf53c (diff)
Ignore the URI query string when checking the path
Diffstat (limited to 'php/outlook.php')
-rw-r--r--php/outlook.php8
1 files changed, 5 insertions, 3 deletions
diff --git a/php/outlook.php b/php/outlook.php
index f6edba6..a694e33 100644
--- a/php/outlook.php
+++ b/php/outlook.php
@@ -26,18 +26,20 @@
// https://[domain]/autodiscover/autodiscover.xml
// https://autodiscover.[domain]/autodiscover/autodiscover.xml
-if ($_SERVER['REQUEST_URI'] == "/autodiscover/autodiscover.xml"
+$request_path = explode("?", $_SERVER['REQUEST_URI'])[0];
+
+if ($request_path == "/autodiscover/autodiscover.xml"
&& preg_match('/^autodiscover\.(.*)$/', $_SERVER['HTTP_HOST'], $matches))
{
$domain = $matches[1];
}
-else if ($_SERVER['REQUEST_URI'] == "/autodiscover/autodiscover.xml") {
+else if ($request_path == "/autodiscover/autodiscover.xml") {
$domain = $_SERVER['HTTP_HOST'];
}
else {
http_response_code(500);
header('Content-Type: text/plain');
- echo "Unable to determine email domain from //".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
+ echo "Unable to determine email domain from //".$_SERVER['HTTP_HOST'].$request_path;
exit(1);
}