mirror of
https://github.com/laravel/valet.git
synced 2026-02-05 00:20:08 +01:00
Explain this disgusting grue
This commit is contained in:
@@ -119,8 +119,27 @@ public function mutateUri($uri)
|
||||
*/
|
||||
public function serveStaticFile($staticFilePath, $sitePath, $siteName, $uri)
|
||||
{
|
||||
/**
|
||||
* Back story...
|
||||
*
|
||||
* PHP docs *claim* you can set default_mimetype = "" to disable the default
|
||||
* Content-Type header. This works in PHP 7+, but in PHP 5.* it sends an
|
||||
* *empty* Content-Type header, which is significantly different than
|
||||
* sending *no* Content-Type header.
|
||||
*
|
||||
* However, if you explicitly set a Content-Type header, then explicitly
|
||||
* remove that Content-Type header, PHP seems to not re-add the default.
|
||||
*
|
||||
* I have a hard time believing this is by design and not coincidence.
|
||||
*
|
||||
* Burn. it. all.
|
||||
*/
|
||||
header('Content-Type: text/html');
|
||||
header_remove('Content-Type');
|
||||
|
||||
/**
|
||||
* Tell Caddy to handle the static file itself, using it's `internal` feature.
|
||||
*/
|
||||
header('X-Accel-Redirect: ' . $staticFilePath);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user