CORS error while implementing Stream Tus direct uploads with a PHP-based backend

Hello Community!

I’ve been trying to implement direct uploads using Tus, but I’ve encountered a CORS error that I haven’t been able to resolve. I know there are plenty of posts discussing similar errors in this implementation, but I haven’t found a solution among them.
For context, we’re using the tus-js-client in an Angular-based site with Laravel as the backend. Following the official documentation, we’ve coded an endpoint with the following PHP code:

function videoUploadUrlTest(Request $request)
{
    $endpoint = sprintf('https://api.cloudflare.com/client/v4/accounts/%s/stream?direct_user=true', config('cloudflare.account_id'));

    $guzzleHttpClient = new Client();
    $response = $guzzleHttpClient->post($endpoint, [
        'headers' => [
            'Authorization' => 'bearer ' . config('cloudflare.api_token'),
            'Tus-Resumable' => '1.0.0',
            'Upload-Length' => $request->header('Upload-Length'),
            'Upload-Metadata' => $request->header('Upload-Metadata') . ',' . implode(',', [
                'maxDurationSeconds ' . base64_encode(60)
            ])
        ],
    ]);

    $destination = $response->getHeader('Location')[0];

    return response(content: null, status: 201, headers: [
        'Access-Control-Expose-Headers' => 'Location',
        'Access-Control-Allow-Headers' => '*',
        'Access-Control-Allow-Origin' => '*',
        'Location' => $destination,
    ]);
}

Next, we’ve used the endpoint directly in the Tus client as follows:

console.log('Uploading file:', file.name, 'to:', endpoint);

const tusUpload = new Upload(file, {
    endpoint, // Backend endpoint
    retryDelays: [],
    metadata: { filename: file.name, filetype: file.type, name: file.name },
    chunkSize: 50 * 1024 * 1024,

    onBeforeRequest: function (req) {
        if (req.getURL() === endpoint) { // Auth token only when calling the backend
            req.setHeader('Authorization', backendToken);
        }
    },
    onError: (error) => {
        console.log('Failed because: ' + error);
    },
    onProgress: (bytesUploaded, bytesTotal) => {
        const percentage = ((bytesUploaded / bytesTotal) * 100).toFixed(2);
        console.log(bytesUploaded, bytesTotal, percentage + '%');
    },
    onSuccess: () => {
        console.log('Download %s from %s', file.name, upload.url);
    },
});

tusUpload.start();

When the code is executed, we receive the following CORS error in the PATCH call:

Here, I’m including the response headers in case they provide any information regarding the error:



I would greatly appreciate any insights or suggestions to help us resolving this error. Thank you in advance for your help!

1 Like

Same problem here, I posted similar findings here Cloudflare Stream TUS Upload - CORS XmlHttpRequest error (pt 2) - #10 by jaken

I do however get a different domain & headers on my option request though: https://production.gateway.api.cloudflare.com/client/

After reading the forums, I see a handful of devs with the same problem within the last 30 days. As far as I can tell, this is a different problem than those who mistakenly tried to send their auth token from the browser.

Edit: this was my solution Cloudflare Stream TUS Upload - CORS XmlHttpRequest error (pt 2) - #16 by schachte

Jake, thanks for your response!

You’re absolutely correct in pointing out that the inclusion of the auth token is a commonly discussed error. As you’ve observed, I want to highlight that I’m only including the authorization token in the initial request to the backend endpoint. This header isn’t sent to Cloudflare according to the browser. However, I’ve previously tested the same endpoint without the authorization token and encountered the same behavior.

Regarding the different domain, I’ve also previously noticed that you receive the production.gateway.api.cloudflare.com domain as response when you make the POST request in the backend without the direct_user option (api.cloudflare.com/client/v4/accounts/{account_id}/stream instead of api.cloudflare.com/client/v4/accounts/{account_id}/stream?direct_user=true). In this case, the second OPTIONS request to Cloudflare works correctly, but I encountered the following error in the PATCH request: “Reason: CORS header ‘Access-Control-Allow-Origin’ missing). Status code: 400.” Although the API reference doesn’t mention it explicitly, I’m assuming that the correct URL should use the direct_user according to the documentation.

@dev215 - I’m still trying to reproduce your failure and wrote a PHP implementation and still can’t see what you’re seeing. (See below repo). Any chance you can confirm if this behavior is deterministic? Also curious if you could upload a corresponding HAR file that I could analyze.

Would there maybe be something with:

  • A reverse proxy you’re using (how are you hosting the PHP backend locally?)
  • Browser extension conflict?

The code below is working. It would be interesting to know if the below code works for you as we can rule out any browser extension issues. Added run instructions in the README.

@schachte, thank you for your time. Your PHP code will certainly be a valuable resource for future developers.

Unfortunately, after building the image from your repository using Docker, I’ve encountered the same error with your implementation. As you suggested, here is the HAR file:

{
  "log": {
    "version": "1.2",
    "creator": {
      "name": "Firefox",
      "version": "123.0.1"
    },
    "browser": {
      "name": "Firefox",
      "version": "123.0.1"
    },
    "pages": [
      {
        "id": "page_3",
        "pageTimings": {
          "onContentLoad": -1,
          "onLoad": -1
        },
        "startedDateTime": "2024-03-15T17:57:43.905+01:00",
        "title": "http://localhost:32775/"
      }
    ],
    "entries": [
      {
        "startedDateTime": "2024-03-15T17:57:43.905+01:00",
        "request": {
          "bodySize": 0,
          "method": "POST",
          "url": "http://localhost:32775/server/tus.php",
          "httpVersion": "HTTP/1.1",
          "headers": [
            {
              "name": "Host",
              "value": "localhost:32775"
            },
            {
              "name": "User-Agent",
              "value": "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:123.0) Gecko/20100101 Firefox/123.0"
            },
            {
              "name": "Accept",
              "value": "*/*"
            },
            {
              "name": "Accept-Language",
              "value": "en-US,en;q=0.5"
            },
            {
              "name": "Accept-Encoding",
              "value": "gzip, deflate, br"
            },
            {
              "name": "Tus-Resumable",
              "value": "1.0.0"
            },
            {
              "name": "Upload-Length",
              "value": "4849792"
            },
            {
              "name": "Upload-Metadata",
              "value": "name VnRFZEMzRHAyaGtoNU51VmlMbVRUbktGUTR5NW5jRmlza1Q2VXFTTi5tcDQ=,filename VnRFZEMzRHAyaGtoNU51VmlMbVRUbktGUTR5NW5jRmlza1Q2VXFTTi5tcDQ=,filetype dmlkZW8vbXA0,maxDurationSeconds NjAw"
            },
            {
              "name": "Origin",
              "value": "http://localhost:32775"
            },
            {
              "name": "Connection",
              "value": "keep-alive"
            },
            {
              "name": "Referer",
              "value": "http://localhost:32775/"
            },
            {
              "name": "Cookie",
              "value": "__stripe_mid=52df55fd-2872-43c6-848f-115117bb19c5f5608d"
            },
            {
              "name": "Sec-Fetch-Dest",
              "value": "empty"
            },
            {
              "name": "Sec-Fetch-Mode",
              "value": "cors"
            },
            {
              "name": "Sec-Fetch-Site",
              "value": "same-origin"
            },
            {
              "name": "Content-Length",
              "value": "0"
            }
          ],
          "cookies": [
            {
              "name": "__stripe_mid",
              "value": "52df55fd-2872-43c6-848f-115117bb19c5f5608d"
            }
          ],
          "queryString": [],
          "headersSize": 726
        },
        "response": {
          "status": 200,
          "statusText": "OK",
          "httpVersion": "HTTP/1.1",
          "headers": [
            {
              "name": "Date",
              "value": "Fri, 15 Mar 2024 16:57:43 GMT"
            },
            {
              "name": "Server",
              "value": "Apache/2.4.56 (Debian)"
            },
            {
              "name": "X-Powered-By",
              "value": "PHP/8.0.30"
            },
            {
              "name": "Content-Length",
              "value": "0"
            },
            {
              "name": "Connection",
              "value": "keep-alive, Keep-Alive"
            },
            {
              "name": "Location",
              "value": "https://upload.videodelivery.net/tus/0dcaf499696510da289e105d383f85fb?tusv2=true"
            },
            {
              "name": "CF-Ray",
              "value": "864e0b55dac25e44-MAD"
            },
            {
              "name": "CF-Cache-Status",
              "value": "DYNAMIC"
            },
            {
              "name": "Cache-Control",
              "value": "no-store"
            },
            {
              "name": "Set-Cookie",
              "value": "__cfruid=fe1de31b320368dff601833a6505f3ff8e87bfb8-1710521866; path=/; domain=.api.cloudflare.com; HttpOnly; Secure; SameSite=None"
            },
            {
              "name": "access-control-expose-headers",
              "value": "Location"
            },
            {
              "name": "stream-media-id",
              "value": "0dcaf499696510da289e105d383f85fb"
            },
            {
              "name": "tus-resumable",
              "value": "1.0.0"
            },
            {
              "name": "x-content-type-options",
              "value": "nosniff"
            },
            {
              "name": "Access-Control-Allow-Headers",
              "value": "*"
            },
            {
              "name": "Access-Control-Allow-Origin",
              "value": "*"
            },
            {
              "name": "Keep-Alive",
              "value": "timeout=5, max=100"
            },
            {
              "name": "Content-Type",
              "value": "text/html; charset=UTF-8"
            }
          ],
          "cookies": [
            {
              "name": "__cfruid",
              "value": "fe1de31b320368dff601833a6505f3ff8e87bfb8-1710521866"
            }
          ],
          "content": {
            "mimeType": "text/html; charset=UTF-8",
            "size": 0,
            "text": ""
          },
          "redirectURL": "https://upload.videodelivery.net/tus/0dcaf499696510da289e105d383f85fb?tusv2=true",
          "headersSize": 769,
          "bodySize": 769
        },
        "cache": {},
        "timings": {
          "blocked": 0,
          "dns": 0,
          "connect": 0,
          "ssl": 0,
          "send": 0,
          "wait": 1570,
          "receive": 0
        },
        "time": 1570,
        "_securityState": "insecure",
        "serverIPAddress": "127.0.0.1",
        "connection": "32775",
        "pageref": "page_3"
      },
      {
        "startedDateTime": "2024-03-15T17:57:45.500+01:00",
        "request": {
          "bodySize": 0,
          "method": "OPTIONS",
          "url": "https://upload.videodelivery.net/tus/0dcaf499696510da289e105d383f85fb?tusv2=true",
          "httpVersion": "",
          "headers": [
            {
              "name": "Host",
              "value": "upload.videodelivery.net"
            },
            {
              "name": "User-Agent",
              "value": "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:123.0) Gecko/20100101 Firefox/123.0"
            },
            {
              "name": "Accept",
              "value": "*/*"
            },
            {
              "name": "Accept-Language",
              "value": "en-US,en;q=0.5"
            },
            {
              "name": "Accept-Encoding",
              "value": "gzip, deflate, br"
            },
            {
              "name": "Access-Control-Request-Method",
              "value": "PATCH"
            },
            {
              "name": "Access-Control-Request-Headers",
              "value": "content-type,tus-resumable,upload-offset"
            },
            {
              "name": "Referer",
              "value": "http://localhost:32775/"
            },
            {
              "name": "Origin",
              "value": "http://localhost:32775"
            },
            {
              "name": "Connection",
              "value": "keep-alive"
            },
            {
              "name": "Sec-Fetch-Dest",
              "value": "empty"
            },
            {
              "name": "Sec-Fetch-Mode",
              "value": "cors"
            },
            {
              "name": "Sec-Fetch-Site",
              "value": "cross-site"
            }
          ],
          "cookies": [],
          "queryString": [
            {
              "name": "tusv2",
              "value": "true"
            }
          ],
          "headersSize": 552
        },
        "response": {
          "status": 0,
          "statusText": "",
          "httpVersion": "",
          "headers": [],
          "cookies": [],
          "content": {
            "mimeType": "",
            "size": 0,
            "encoding": "base64",
            "text": ""
          },
          "redirectURL": "",
          "headersSize": 0,
          "bodySize": 0
        },
        "cache": {},
        "timings": {
          "blocked": 16,
          "dns": 175,
          "connect": 176,
          "ssl": 192,
          "send": 0,
          "wait": 0,
          "receive": 0
        },
        "time": 559,
        "_securityState": "insecure",
        "pageref": "page_3"
      },
      {
        "startedDateTime": "2024-03-15T17:57:45.708+01:00",
        "request": {
          "bodySize": 0,
          "method": "OPTIONS",
          "url": "https://upload.videodelivery.net/tus/0dcaf499696510da289e105d383f85fb?tusv2=true",
          "httpVersion": "",
          "headers": [
            {
              "name": "Host",
              "value": "upload.videodelivery.net"
            },
            {
              "name": "User-Agent",
              "value": "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:123.0) Gecko/20100101 Firefox/123.0"
            },
            {
              "name": "Accept",
              "value": "*/*"
            },
            {
              "name": "Accept-Language",
              "value": "en-US,en;q=0.5"
            },
            {
              "name": "Accept-Encoding",
              "value": "gzip, deflate, br"
            },
            {
              "name": "Access-Control-Request-Method",
              "value": "HEAD"
            },
            {
              "name": "Access-Control-Request-Headers",
              "value": "tus-resumable"
            },
            {
              "name": "Referer",
              "value": "http://localhost:32775/"
            },
            {
              "name": "Origin",
              "value": "http://localhost:32775"
            },
            {
              "name": "Connection",
              "value": "keep-alive"
            },
            {
              "name": "Sec-Fetch-Dest",
              "value": "empty"
            },
            {
              "name": "Sec-Fetch-Mode",
              "value": "cors"
            },
            {
              "name": "Sec-Fetch-Site",
              "value": "cross-site"
            }
          ],
          "cookies": [],
          "queryString": [
            {
              "name": "tusv2",
              "value": "true"
            }
          ],
          "headersSize": 524
        },
        "response": {
          "status": 0,
          "statusText": "",
          "httpVersion": "",
          "headers": [],
          "cookies": [],
          "content": {
            "mimeType": "",
            "size": 0,
            "encoding": "base64",
            "text": ""
          },
          "redirectURL": "",
          "headersSize": 0,
          "bodySize": 0
        },
        "cache": {},
        "timings": {
          "blocked": 23,
          "dns": 163,
          "connect": 178,
          "ssl": 178,
          "send": 0,
          "wait": 0,
          "receive": 0
        },
        "time": 542,
        "_securityState": "insecure",
        "pageref": "page_3"
      },
      {
        "startedDateTime": "2024-03-15T17:57:45.713+01:00",
        "request": {
          "bodySize": 0,
          "method": "PATCH",
          "url": "https://upload.videodelivery.net/tus/0dcaf499696510da289e105d383f85fb?tusv2=true",
          "httpVersion": "",
          "headers": [
            {
              "name": "Host",
              "value": "upload.videodelivery.net"
            },
            {
              "name": "User-Agent",
              "value": "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:123.0) Gecko/20100101 Firefox/123.0"
            },
            {
              "name": "Accept",
              "value": "*/*"
            },
            {
              "name": "Accept-Language",
              "value": "en-US,en;q=0.5"
            },
            {
              "name": "Accept-Encoding",
              "value": "gzip, deflate, br"
            },
            {
              "name": "Tus-Resumable",
              "value": "1.0.0"
            },
            {
              "name": "Upload-Offset",
              "value": "0"
            },
            {
              "name": "Content-Type",
              "value": "application/offset+octet-stream"
            },
            {
              "name": "Content-Length",
              "value": "4849792"
            },
            {
              "name": "Origin",
              "value": "http://localhost:32775"
            },
            {
              "name": "Connection",
              "value": "keep-alive"
            },
            {
              "name": "Referer",
              "value": "http://localhost:32775/"
            },
            {
              "name": "Sec-Fetch-Dest",
              "value": "empty"
            },
            {
              "name": "Sec-Fetch-Mode",
              "value": "cors"
            },
            {
              "name": "Sec-Fetch-Site",
              "value": "cross-site"
            }
          ],
          "cookies": [],
          "queryString": [
            {
              "name": "tusv2",
              "value": "true"
            }
          ],
          "headersSize": 0
        },
        "response": {
          "status": 0,
          "statusText": "",
          "httpVersion": "",
          "headers": [],
          "cookies": [],
          "content": {},
          "redirectURL": "",
          "headersSize": 0,
          "bodySize": -1
        },
        "cache": {},
        "timings": {},
        "time": 0,
        "pageref": "page_3"
      },
      {
        "startedDateTime": "2024-03-15T17:57:45.925+01:00",
        "request": {
          "bodySize": 0,
          "method": "HEAD",
          "url": "https://upload.videodelivery.net/tus/0dcaf499696510da289e105d383f85fb?tusv2=true",
          "httpVersion": "",
          "headers": [
            {
              "name": "Host",
              "value": "upload.videodelivery.net"
            },
            {
              "name": "User-Agent",
              "value": "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:123.0) Gecko/20100101 Firefox/123.0"
            },
            {
              "name": "Accept",
              "value": "*/*"
            },
            {
              "name": "Accept-Language",
              "value": "en-US,en;q=0.5"
            },
            {
              "name": "Accept-Encoding",
              "value": "gzip, deflate, br"
            },
            {
              "name": "Tus-Resumable",
              "value": "1.0.0"
            },
            {
              "name": "Origin",
              "value": "http://localhost:32775"
            },
            {
              "name": "Connection",
              "value": "keep-alive"
            },
            {
              "name": "Referer",
              "value": "http://localhost:32775/"
            },
            {
              "name": "Sec-Fetch-Dest",
              "value": "empty"
            },
            {
              "name": "Sec-Fetch-Mode",
              "value": "cors"
            },
            {
              "name": "Sec-Fetch-Site",
              "value": "cross-site"
            }
          ],
          "cookies": [],
          "queryString": [
            {
              "name": "tusv2",
              "value": "true"
            }
          ],
          "headersSize": 0
        },
        "response": {
          "status": 0,
          "statusText": "",
          "httpVersion": "",
          "headers": [],
          "cookies": [],
          "content": {},
          "redirectURL": "",
          "headersSize": 0,
          "bodySize": -1
        },
        "cache": {},
        "timings": {},
        "time": 0,
        "pageref": "page_3"
      },
      {
        "startedDateTime": "2024-03-15T17:57:46.934+01:00",
        "request": {
          "bodySize": 0,
          "method": "OPTIONS",
          "url": "https://upload.videodelivery.net/tus/0dcaf499696510da289e105d383f85fb?tusv2=true",
          "httpVersion": "",
          "headers": [
            {
              "name": "Host",
              "value": "upload.videodelivery.net"
            },
            {
              "name": "User-Agent",
              "value": "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:123.0) Gecko/20100101 Firefox/123.0"
            },
            {
              "name": "Accept",
              "value": "*/*"
            },
            {
              "name": "Accept-Language",
              "value": "en-US,en;q=0.5"
            },
            {
              "name": "Accept-Encoding",
              "value": "gzip, deflate, br"
            },
            {
              "name": "Access-Control-Request-Method",
              "value": "HEAD"
            },
            {
              "name": "Access-Control-Request-Headers",
              "value": "tus-resumable"
            },
            {
              "name": "Referer",
              "value": "http://localhost:32775/"
            },
            {
              "name": "Origin",
              "value": "http://localhost:32775"
            },
            {
              "name": "Connection",
              "value": "keep-alive"
            },
            {
              "name": "Sec-Fetch-Dest",
              "value": "empty"
            },
            {
              "name": "Sec-Fetch-Mode",
              "value": "cors"
            },
            {
              "name": "Sec-Fetch-Site",
              "value": "cross-site"
            }
          ],
          "cookies": [],
          "queryString": [
            {
              "name": "tusv2",
              "value": "true"
            }
          ],
          "headersSize": 524
        },
        "response": {
          "status": 0,
          "statusText": "",
          "httpVersion": "",
          "headers": [],
          "cookies": [],
          "content": {
            "mimeType": "",
            "size": 0,
            "encoding": "base64",
            "text": ""
          },
          "redirectURL": "",
          "headersSize": 0,
          "bodySize": 0
        },
        "cache": {},
        "timings": {
          "blocked": 31,
          "dns": 187,
          "connect": 202,
          "ssl": 218,
          "send": 0,
          "wait": 0,
          "receive": 0
        },
        "time": 638,
        "_securityState": "insecure",
        "pageref": "page_3"
      },
      {
        "startedDateTime": "2024-03-15T17:57:47.177+01:00",
        "request": {
          "bodySize": 0,
          "method": "HEAD",
          "url": "https://upload.videodelivery.net/tus/0dcaf499696510da289e105d383f85fb?tusv2=true",
          "httpVersion": "",
          "headers": [
            {
              "name": "Host",
              "value": "upload.videodelivery.net"
            },
            {
              "name": "User-Agent",
              "value": "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:123.0) Gecko/20100101 Firefox/123.0"
            },
            {
              "name": "Accept",
              "value": "*/*"
            },
            {
              "name": "Accept-Language",
              "value": "en-US,en;q=0.5"
            },
            {
              "name": "Accept-Encoding",
              "value": "gzip, deflate, br"
            },
            {
              "name": "Tus-Resumable",
              "value": "1.0.0"
            },
            {
              "name": "Origin",
              "value": "http://localhost:32775"
            },
            {
              "name": "Connection",
              "value": "keep-alive"
            },
            {
              "name": "Referer",
              "value": "http://localhost:32775/"
            },
            {
              "name": "Sec-Fetch-Dest",
              "value": "empty"
            },
            {
              "name": "Sec-Fetch-Mode",
              "value": "cors"
            },
            {
              "name": "Sec-Fetch-Site",
              "value": "cross-site"
            }
          ],
          "cookies": [],
          "queryString": [
            {
              "name": "tusv2",
              "value": "true"
            }
          ],
          "headersSize": 0
        },
        "response": {
          "status": 0,
          "statusText": "",
          "httpVersion": "",
          "headers": [],
          "cookies": [],
          "content": {},
          "redirectURL": "",
          "headersSize": 0,
          "bodySize": -1
        },
        "cache": {},
        "timings": {},
        "time": 0,
        "pageref": "page_3"
      },
      {
        "startedDateTime": "2024-03-15T17:57:50.204+01:00",
        "request": {
          "bodySize": 0,
          "method": "OPTIONS",
          "url": "https://upload.videodelivery.net/tus/0dcaf499696510da289e105d383f85fb?tusv2=true",
          "httpVersion": "",
          "headers": [
            {
              "name": "Host",
              "value": "upload.videodelivery.net"
            },
            {
              "name": "User-Agent",
              "value": "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:123.0) Gecko/20100101 Firefox/123.0"
            },
            {
              "name": "Accept",
              "value": "*/*"
            },
            {
              "name": "Accept-Language",
              "value": "en-US,en;q=0.5"
            },
            {
              "name": "Accept-Encoding",
              "value": "gzip, deflate, br"
            },
            {
              "name": "Access-Control-Request-Method",
              "value": "HEAD"
            },
            {
              "name": "Access-Control-Request-Headers",
              "value": "tus-resumable"
            },
            {
              "name": "Referer",
              "value": "http://localhost:32775/"
            },
            {
              "name": "Origin",
              "value": "http://localhost:32775"
            },
            {
              "name": "Connection",
              "value": "keep-alive"
            },
            {
              "name": "Sec-Fetch-Dest",
              "value": "empty"
            },
            {
              "name": "Sec-Fetch-Mode",
              "value": "cors"
            },
            {
              "name": "Sec-Fetch-Site",
              "value": "cross-site"
            }
          ],
          "cookies": [],
          "queryString": [
            {
              "name": "tusv2",
              "value": "true"
            }
          ],
          "headersSize": 524
        },
        "response": {
          "status": 0,
          "statusText": "",
          "httpVersion": "",
          "headers": [],
          "cookies": [],
          "content": {
            "mimeType": "",
            "size": 0,
            "encoding": "base64",
            "text": ""
          },
          "redirectURL": "",
          "headersSize": 0,
          "bodySize": 0
        },
        "cache": {},
        "timings": {
          "blocked": 16,
          "dns": 195,
          "connect": 195,
          "ssl": 238,
          "send": 0,
          "wait": 0,
          "receive": 0
        },
        "time": 644,
        "_securityState": "insecure",
        "pageref": "page_3"
      },
      {
        "startedDateTime": "2024-03-15T17:57:50.449+01:00",
        "request": {
          "bodySize": 0,
          "method": "HEAD",
          "url": "https://upload.videodelivery.net/tus/0dcaf499696510da289e105d383f85fb?tusv2=true",
          "httpVersion": "",
          "headers": [
            {
              "name": "Host",
              "value": "upload.videodelivery.net"
            },
            {
              "name": "User-Agent",
              "value": "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:123.0) Gecko/20100101 Firefox/123.0"
            },
            {
              "name": "Accept",
              "value": "*/*"
            },
            {
              "name": "Accept-Language",
              "value": "en-US,en;q=0.5"
            },
            {
              "name": "Accept-Encoding",
              "value": "gzip, deflate, br"
            },
            {
              "name": "Tus-Resumable",
              "value": "1.0.0"
            },
            {
              "name": "Origin",
              "value": "http://localhost:32775"
            },
            {
              "name": "Connection",
              "value": "keep-alive"
            },
            {
              "name": "Referer",
              "value": "http://localhost:32775/"
            },
            {
              "name": "Sec-Fetch-Dest",
              "value": "empty"
            },
            {
              "name": "Sec-Fetch-Mode",
              "value": "cors"
            },
            {
              "name": "Sec-Fetch-Site",
              "value": "cross-site"
            }
          ],
          "cookies": [],
          "queryString": [
            {
              "name": "tusv2",
              "value": "true"
            }
          ],
          "headersSize": 0
        },
        "response": {
          "status": 0,
          "statusText": "",
          "httpVersion": "",
          "headers": [],
          "cookies": [],
          "content": {},
          "redirectURL": "",
          "headersSize": 0,
          "bodySize": -1
        },
        "cache": {},
        "timings": {},
        "time": 0,
        "pageref": "page_3"
      },
      {
        "startedDateTime": "2024-03-15T17:57:55.533+01:00",
        "request": {
          "bodySize": 0,
          "method": "OPTIONS",
          "url": "https://upload.videodelivery.net/tus/0dcaf499696510da289e105d383f85fb?tusv2=true",
          "httpVersion": "",
          "headers": [
            {
              "name": "Host",
              "value": "upload.videodelivery.net"
            },
            {
              "name": "User-Agent",
              "value": "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:123.0) Gecko/20100101 Firefox/123.0"
            },
            {
              "name": "Accept",
              "value": "*/*"
            },
            {
              "name": "Accept-Language",
              "value": "en-US,en;q=0.5"
            },
            {
              "name": "Accept-Encoding",
              "value": "gzip, deflate, br"
            },
            {
              "name": "Access-Control-Request-Method",
              "value": "HEAD"
            },
            {
              "name": "Access-Control-Request-Headers",
              "value": "tus-resumable"
            },
            {
              "name": "Referer",
              "value": "http://localhost:32775/"
            },
            {
              "name": "Origin",
              "value": "http://localhost:32775"
            },
            {
              "name": "Connection",
              "value": "keep-alive"
            },
            {
              "name": "Sec-Fetch-Dest",
              "value": "empty"
            },
            {
              "name": "Sec-Fetch-Mode",
              "value": "cors"
            },
            {
              "name": "Sec-Fetch-Site",
              "value": "cross-site"
            }
          ],
          "cookies": [],
          "queryString": [
            {
              "name": "tusv2",
              "value": "true"
            }
          ],
          "headersSize": 524
        },
        "response": {
          "status": 0,
          "statusText": "",
          "httpVersion": "",
          "headers": [],
          "cookies": [],
          "content": {
            "mimeType": "",
            "size": 0,
            "encoding": "base64",
            "text": ""
          },
          "redirectURL": "",
          "headersSize": 0,
          "bodySize": 0
        },
        "cache": {},
        "timings": {
          "blocked": 21,
          "dns": 147,
          "connect": 163,
          "ssl": 185,
          "send": 0,
          "wait": 0,
          "receive": 0
        },
        "time": 516,
        "_securityState": "insecure",
        "pageref": "page_3"
      },
      {
        "startedDateTime": "2024-03-15T17:57:55.735+01:00",
        "request": {
          "bodySize": 0,
          "method": "HEAD",
          "url": "https://upload.videodelivery.net/tus/0dcaf499696510da289e105d383f85fb?tusv2=true",
          "httpVersion": "",
          "headers": [
            {
              "name": "Host",
              "value": "upload.videodelivery.net"
            },
            {
              "name": "User-Agent",
              "value": "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:123.0) Gecko/20100101 Firefox/123.0"
            },
            {
              "name": "Accept",
              "value": "*/*"
            },
            {
              "name": "Accept-Language",
              "value": "en-US,en;q=0.5"
            },
            {
              "name": "Accept-Encoding",
              "value": "gzip, deflate, br"
            },
            {
              "name": "Tus-Resumable",
              "value": "1.0.0"
            },
            {
              "name": "Origin",
              "value": "http://localhost:32775"
            },
            {
              "name": "Connection",
              "value": "keep-alive"
            },
            {
              "name": "Referer",
              "value": "http://localhost:32775/"
            },
            {
              "name": "Sec-Fetch-Dest",
              "value": "empty"
            },
            {
              "name": "Sec-Fetch-Mode",
              "value": "cors"
            },
            {
              "name": "Sec-Fetch-Site",
              "value": "cross-site"
            }
          ],
          "cookies": [],
          "queryString": [
            {
              "name": "tusv2",
              "value": "true"
            }
          ],
          "headersSize": 0
        },
        "response": {
          "status": 0,
          "statusText": "",
          "httpVersion": "",
          "headers": [],
          "cookies": [],
          "content": {},
          "redirectURL": "",
          "headersSize": 0,
          "bodySize": -1
        },
        "cache": {},
        "timings": {},
        "time": 0,
        "pageref": "page_3"
      }
    ]
  }
}

This confirms to me that the error is not related to our PHP backend or our own implementation. Despite not using any browser extensions, I’ve reproduced the error across all my installed browsers (Firefox, Chrome, Edge). Additionally, I’ve disabled the antivirus software (Kaspersky) to rule out any interference with the network, but the error persists.
Furthermore, I’ve generated a new API token using the ‘Read and write to Cloudflare Stream and Images’ template, but unfortunately, this hasn’t resolved the issue.

This is really strange as I’m not actually able to correlate anything outside the URL creation itself to this account for this video ID in our logs. In the HAR I don’t see a server failure or response in the OPTIONS request, which also makes me wonder if this is failing to go out due to some environment issue :thinking: . Do you have some type of VPN enabled?

As for the demo environment, I see the port is changed. Did you modify that yourself in the docker-compose? Just want to make sure everything is replicated exactly to rule out environment specific problems.

If you right-click the OPTIONS request and copy as curl and paste in terminal with -vvv appended to it, what do you see?

@schachte, my apologies for any confusion regarding the test environment. I made some changes in an attempt to gather more information… However, upon testing the unmodified project, I obtain the same error.

Regarding the VPN, no, I don’t use any kind of VPN.

Here’s the output of the curl request:

Per the screenshot, this is looking like a certificate issue that is pertinent to Windows systems from what I’ve been reading. Is it possible for you to test this on a different device to confirm?

Either way, would be interesting to find the root cause causing this to happen to you.