Tus error 400

I have some problem with the direct upload by TUS. I’m using php on my server and I can get the upload link from the https://api.cloudflare.com/client/v4/accounts/xxxxxx/stream?direct_user=true URL.

I cut the link from the response header and set it in the php header('location: '.$header)
I use tus.js on the client side. I start the upload to my php code and set the tus.js header → ‘Tus-Resumable’: ‘1.0.0’. But I get an error 400: TUS uploads must include Tus-Resumable header

What should I do? What’s the problem with the code? I think the problem is in the php code, but I don’t know what…

The PHP code where I get the link and this is where I upload files with tus.js:

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,“https://api.cloudflare.com/client/v4/accounts/redacted/stream?direct_user=true”);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(‘Authorization: Bearer redacted’,‘Tus-Resumable: 1.0.0’,‘Upload-Length:1’));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HEADER, 1);
$server_output = curl_exec($ch);
curl_close ($ch);
header(‘Access-Control-Expose-Headers: Location’);
header(‘Access-Control-Allow-Headers: *’);
header(‘Access-Control-Allow-Origin: *’);
header('Location: '.$header);

Hey @christian6

I have temporarily hidden your post as the code you posted contains a API token that is valid and active at the moment

cc @cloonan in case the report didn’t work correctly :slightly_smiling_face: