I'm having an m3u playlist which downloads fine and works when open in VLC after the download. However I want that someone could just paste the URL to VLC and it would work directly without the need to download the file first. I'm using laravel for this but I don't need to. Here is the download code:
$headers = ["Content-Type: audio/x-mpegurl"];
// Trigger the download
return response()->download('/lists/edited.m3u', urlencode($username) . '.m3u', $headers);