Skip to content

Commit 10d20b5

Browse files
committed
Fix blank homepage from cached CORS rejection
1 parent 890ae03 commit 10d20b5

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

include/prepend.inc

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,12 @@ header("Permissions-Policy: interest-cohort=()");
2626
}
2727

2828
$host = parse_url($_SERVER["HTTP_ORIGIN"]);
29-
if (!preg_match('/^(.+\.)?php\.net$/', $host["host"])) {
30-
if ($host["host"] != $_SERVER["SERVER_NAME"]) {
31-
exit(10);
29+
if (!preg_match('/^(.+\.)?php\.net$/', $host["host"] ?? '')) {
30+
if (($host["host"] ?? '') != $_SERVER["SERVER_NAME"]) {
31+
// Unknown origin: just skip the CORS headers. Don't exit,
32+
// or we send a blank 200 with no Cache-Control that the CDN
33+
// happily caches as an empty homepage (see issue #1955).
34+
return;
3235
}
3336
}
3437
if (isset($host["port"])) {

0 commit comments

Comments
 (0)