Stream file from an external api call to browser without caching
So I’ve been trying to solve a challenge lately and would love this community’s input on it.
The challenge: stream a file to the users browser without caching it in php.
The file is coming through an http call (the file is in a salesforce and i am getting it through a simple API call)
I’ve tried downloading to storage - then serve it to the user, works fine but I have to wait for laravel to save it - serve it and then delete it.
Next step was to use fopen and stream the file without saving - which leads to instantly start the download for the user without first waiting for it to arrive in laravel storage. Problem is - something is limiting the download to around 200-300kb/s
I’m looking for ideas to serve the file while the http call is happening, meaning php will work as a ‘proxy’.
I hope my description makes sense. Will post my controller code too.