1
0
Fork 0

Proxy fix

merge-requests/3/head
Christiaan Goossens 7 years ago
parent c275c8f874
commit ffe56bcf9b

@ -28,10 +28,9 @@ if (PHP_SAPI == 'cli-server') {
// something which should probably be served as a static file // something which should probably be served as a static file
$url = parse_url($_SERVER['REQUEST_URI']); $url = parse_url($_SERVER['REQUEST_URI']);
$file = __DIR__ . $url['path']; $file = __DIR__ . $url['path'];
if (is_file($file)) { if (is_file($file)) {
return false; return false;
} elseif (pathinfo($url['path'], PATHINFO_EXTENSION) !== "") {
return false;
} }
} }

@ -14,16 +14,19 @@
namespace Inforbank; namespace Inforbank;
use Bat\MimeTypeTool;
class Proxy class Proxy
{ {
public function __invoke($request, $response, $next) public function __invoke($request, $response, $next)
{ {
$uri = $request->getUri(); $uri = $request->getUri();
$path = $uri->getPath(); $path = $uri->getPath();
if (strpos($path, 'assets/') !== false) { $pa = explode('assets/', $path, 2);
if (file_exists($path)) {
if (isset($pa[1])) {
$path = __DIR__ . '/../assets/'.$pa[1];
$path = realpath($path);
if ($path) {
$ext = pathinfo($path, PATHINFO_EXTENSION); $ext = pathinfo($path, PATHINFO_EXTENSION);
$ext2Mime = array( $ext2Mime = array(