seeking through an hour of footage issues a long tail * of Range requests; nginx's static handler answers those with 206s on * its own, and drops the Content-Length below in favour of the range it * actually served. Anything else — S3 and friends — gets a short-lived * presigned URL carrying an inline disposition, which the object store * ranges just as well. * * Callers must have established that the mime type is inline-safe first; * PreviewKind is the allowlist, and the reason there is one. */ class InlineFileResponse { public function make(File $file): Response|RedirectResponse { if ($file->disk !== 'files') { $url = Storage::disk($file->disk)->temporaryUrl( $file->path, now()->addHour(), ['ResponseContentDisposition' => ContentDisposition::inline($file->original_name)], ); return redirect()->away($url); } return response('', 200, [ 'X-Accel-Redirect' => '/protected-files/'.$file->path, 'Content-Type' => $file->mime_type, 'Content-Disposition' => ContentDisposition::inline($file->original_name), 'Content-Length' => (string) $file->size, ]); } }