Add support for alternative download domain #3

Merged
Francesco Siddi merged 4 commits from cdn-support-for-downloads into develop 2024-05-30 09:22:56 +02:00
Showing only changes of commit a01ea42be3 - Show all commits

View File

@ -87,6 +87,13 @@ function handleRequest() {
$url = parse_url($_SERVER['REQUEST_URI']); $url = parse_url($_SERVER['REQUEST_URI']);
// Fail requests directed at HOST_CDN if they do not match the /download/*/* pattern
$pattern = "/^\/download\/[^\/]+\/[^\/]+$/";
if (getenv('HOST_CDN') && $_SERVER['HTTP_HOST'] == getenv('HOST_CDN') && !preg_match($pattern, $url['path'])) {
header("HTTP/1.0 404 Not Found");
exit();
}
if ($url['path'] === '/') { if ($url['path'] === '/') {
// Root URL // Root URL
header('Location: /download/daily/'); header('Location: /download/daily/');