Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

brownleprechaun's avatar

File can't be downloaded securely

Hi folks,

I'm running a project through Forge that has an element of file downloading with it, been developing it locally and testing on a small Digital Ocean droplet before deploying via Forge.

A problem has occurred where I have a job that runs and produces a zip file in the background, once complete it creates a link that can be followed by the user to download the zip file produced. On localhost and the test environment, this works a treat - the queue is run, the zip is generated, the download url is created and notified to the user.

On the live server however, all this works as planned except that when the link is clicked, the file is not being downloaded. On Chrome it's not doing anything, but with a test on Edge the downloaded file has an alert beside it saying that it "can't be downloaded securely".

Fair enough on Edge, I can click on keep and manually process the download so it will download as normal to my machine, however, this is still not where I want to be.

I've reviewed similar posts both linked below #1 and #2, and my code follows standard Laravel recommendations for downloading files, e.g. the handler that downloads the file is done via a generated url string which is then passed to the response:

return response()->download(Storage::path($task_params->download_url))

Only thing I'm thinking is there may be an issue with the SSL given that the download works as expected on local and test environment which both run off http://, my environment settings have the APP_URL set as https:// - and the application itself runs via Forge which has https:// switched on by default.

Would appreciate any pointers on this.

#1 https://laracasts.com/discuss/channels/laravel/response-download-not-working-on-server

#2 https://laracasts.com/discuss/channels/laravel/cant-download-file

0 likes
2 replies
jlrdw's avatar

Is the link given to download https?

1 like
brownleprechaun's avatar
Level 1

@jlrdw pointed me in the right direction here, I assumed it was being downloaded as https as I have my APP_URL set to point to https://, but obviously not.

Anyway, I done a bit more digging as my download URL is generated off the back of a background task, ended up following this guidance: https://laracasts.com/discuss/channels/laravel/streaming-a-file-for-download-content-disposition-the-laravel-way?page=1&replyId=352263

...which indicated to pass some headers through which seems to have solved the problem.

Please or to participate in this conversation.