0
I need your help to find a way to be a 'proxy' between the frontend and a third-party software component using Laravel.
Third-party software is on my company’s network and generates the files on demand. For example, if I click http://mycompany-third-party.com/12/csv, it will read the database data and deliver it for download as a response (in this case, a csv file).
But I cannot allow users to reach the third party endpoint directly, so I want to use the Laravel (guzzle) to request the file to a third party and then redirect it to the specific client without storing it on my local disk.
How can I do something like this using Laravel / guzzle or another library?
This is the way I tried
$response = Http::withOptions(['stream' => true])->withHeaders([
'X-Metabase-Session' => $this->token,
])->post('http://mycompany-third-party.com/12/csv');
$headers = $response->headers();
return response($response->getBody())->withHeaders($headers);