Skip to content

Commit a76dbe2

Browse files
authored
Merge pull request #17911 from nextcloud/backport/16846/stable15
[stable15] Always check via http and https whether htaccess is working
2 parents 21d6507 + de53c97 commit a76dbe2

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

lib/private/legacy/util.php

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1249,14 +1249,26 @@ public function isHtaccessWorking(\OCP\IConfig $config) {
12491249
$content = false;
12501250
}
12511251

1252+
if (strpos($url, 'https:') === 0) {
1253+
$url = 'http:' . substr($url, 6);
1254+
} else {
1255+
$url = 'https:' . substr($url, 5);
1256+
}
1257+
1258+
try {
1259+
$fallbackContent = \OC::$server->getHTTPClientService()->newClient()->get($url)->getBody();
1260+
} catch (\Exception $e) {
1261+
$fallbackContent = false;
1262+
}
1263+
12521264
// cleanup
12531265
@unlink($testFile);
12541266

12551267
/*
12561268
* If the content is not equal to test content our .htaccess
12571269
* is working as required
12581270
*/
1259-
return $content !== $testContent;
1271+
return $content !== $testContent && $fallbackContent !== $testContent;
12601272
}
12611273

12621274
/**

0 commit comments

Comments
 (0)