check your Laravel logs - there is probably a stack dump for each occurence - this will probably tell you what is going on.
storage/logs/laravel.log
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
I'm trying to do a simple download of a single pdf file (code below). I believe I'm getting the error because the server is cutting off the connection before finishing the download (chunking?). This happens maybe 20% of the time. The files that fail have no rhyme or reason. Sometimes the same file that failed 4 times works the next try. I'm using Forge and the cheapest DO option.
In Chrome this materializes as the file showing in the download bar with "Failed - Network Error". I can then choose "Resume" download and it will work once or twice.
Has anyone else come across this issue?
public function show()
{
$pathToFile = storage_path(). '/app/' .$this->path;
$name = $this->user->first_name . ' ' . $this->user->last_name;
$headers = array(
'Content-Type' => 'application/pdf',
);
return response()->download($pathToFile, $name, $headers);
}
Please or to participate in this conversation.