diff --git a/apps/dav/lib/CalDAV/WebcalCaching/Connection.php b/apps/dav/lib/CalDAV/WebcalCaching/Connection.php index 3d12c92c49a69..b274eb1845116 100644 --- a/apps/dav/lib/CalDAV/WebcalCaching/Connection.php +++ b/apps/dav/lib/CalDAV/WebcalCaching/Connection.php @@ -34,6 +34,14 @@ public function queryWebcalFeed(array $subscription): ?string { return null; } + // calendar/#7234 - ICS feeds hosted on O365 can return HTTP 500 when the UA string isn't satisfactory.. + $uaString = 'Nextcloud Webcal Service'; + if (parse_url($url, PHP_URL_HOST) === 'outlook.office365.com') { + // 2025/08/20 - the required format/values here are not documented; this string based on research + // from: https://github.com/bitfireAT/icsx5/discussions/654#discussioncomment-14158051 + $uaString = 'Nextcloud (Linux) Chrome/66'; + } + $allowLocalAccess = $this->config->getValueString('dav', 'webcalAllowLocalAccess', 'no'); $params = [ @@ -41,7 +49,7 @@ public function queryWebcalFeed(array $subscription): ?string { 'allow_local_address' => $allowLocalAccess === 'yes', ], RequestOptions::HEADERS => [ - 'User-Agent' => 'Nextcloud Webcal Service', + 'User-Agent' => $uaString, 'Accept' => 'text/calendar, application/calendar+json, application/calendar+xml', ], ];