Simple initial X-Accel-Redirect method.

This commit is contained in:
Eric Teunis de Boone 2020-12-17 15:04:49 +01:00
parent 835e595e75
commit 99b7a77444
3 changed files with 27 additions and 1 deletions

View file

@ -1,3 +1,5 @@
# hippopotato # hippopotato
Simple files storage based on flat files Simple files storage based on flat files.
Currently based on PHP and NGiNX.

2
files/.gitignore vendored Normal file
View file

@ -0,0 +1,2 @@
*
!.gitignore

22
public/index.php Normal file
View file

@ -0,0 +1,22 @@
<?php
$limit_rate = Null;
$url = $_SERVER['REQUEST_URI'];
$file_directory_alias = '/files/';
$file_directory = '../'. $file_directory_alias;
if ( file_exists($file_directory . $url) )
{
if ( !is_null($limit_rate) )
{
header("X-Accel-Limit-Rate: {$limite_rate}");
}
header("X-Accel-Redirect: {$file_directory_alis}{$url}");
exit(0);
}
http_response_code(404);
exit(4);