disk()); $temporaryURL = $fs->temporaryUrl($this->streamable->path(), now()->addMinutes(5)); // Get the url information $url_scheme = parse_url($temporaryURL, PHP_URL_SCHEME); $url_host = parse_url($temporaryURL, PHP_URL_HOST); $url_path_query = parse_url($temporaryURL, PHP_URL_PATH).'?'.parse_url($temporaryURL, PHP_URL_QUERY); $link = "{$this->nginxRedirect()}$url_scheme/$url_host$url_path_query"; $response = new Response(); $disposition = $response->headers->makeDisposition($disposition, $this->streamable->basename()); return $response->withHeaders([ 'Accept-Ranges' => 'bytes', 'Content-Type' => $this->streamable->mimetype(), 'Content-Length' => $this->streamable->size(), 'Content-Disposition' => $disposition, 'X-Accel-Redirect' => $link, ]); } /** * Get the location of the nginx internal redirect. */ abstract protected function nginxRedirect(): string; }