Cloudflare Stream Beta Feedback

Hi, I’ve experienced the same problem like @ mszoke87 when I used java to upload a video to cloudflare programmatically. Do you have solution to this problem without modifying the TusClient library? We are considering cloudflare as a solution for our streaming platform, but we are heavily relying on java. That is why this could be a showstopper for us. Please advice.

Hi @mszoke87. Thank you very much for the hints. Could you please give a little more explanation on your proposed fix (a code snippet will be perfect )? I’ve faced the same issue as you described in the post.

It’s been awhile, but ultimately this is what I modified, based off of
In I modified openConnection to reference a static method I added to the class which sets PATCH as an allowed method:

private void openConnection() throws IOException, ProtocolException {
        // Only open a connection, if we have none open.
        if(connection != null) {

        bytesRemainingForRequest = requestPayloadSize;


        connection = (HttpURLConnection) uploadURL.openConnection();
        connection.setRequestProperty("Upload-Offset", Long.toString(offset));
        connection.setRequestProperty("Content-Type", "application/offset+octet-stream");
        connection.setRequestProperty("Expect", "100-continue");
        try {
            // Check whether we are running on a buggy JRE
        } catch ( pe) {
            connection.setRequestProperty("X-HTTP-Method-Override", "PATCH");

        try {
            output = connection.getOutputStream();
        } catch( pe) {
            // If we already have a response code available, our expectation using the "Expect: 100-
            // continue" header failed and we should handle this response.
            if(connection.getResponseCode() != -1) {

            throw pe;

The allowMethods function:

private static void allowMethods(String... methods) {
        try {
            Field methodsField = HttpURLConnection.class.getDeclaredField("methods");

            Field modifiersField = Field.class.getDeclaredField("modifiers");
            modifiersField.setInt(methodsField, methodsField.getModifiers() & ~Modifier.FINAL);


            String[] oldMethods = (String[]) methodsField.get(null);
            Set<String> methodsSet = new LinkedHashSet<>(Arrays.asList(oldMethods));
            String[] newMethods = methodsSet.toArray(new String[0]);

            methodsField.set(null/*static field*/, newMethods);
        } catch (NoSuchFieldException | IllegalAccessException e) {
            throw new IllegalStateException(e);
1 Like

Thank you on your prompt reply. That is the answer I was looking for. So you’ve uses reflection to extend the HttpUrlConnection class to accept the “PATCH” method. But what about , you’ve change directly the class itself? If you are using the library as a Maven dependency you do not have access to the source code so you can not make changes on it. Do you actually fork the TusClient project change the source code and build a new jar that you than import it into your project?

Yeah unfortunately i’ve had to check out the repo to do changes. It’s not necessarily a problem with the TusClient but the CloudFlare implementation. They need to support the Http-Method-Override header. My solution is not a long term solution.

Who should I reach out to discuss pricing?

I’d like to see manual video quality adjusting also, asap.

There should be a way to implement Cloudflare Stream with Wordpress, using the existing Cloudflare for Wordpress plugin.

At the moment, I have to use an additional plugin to paste the Cloudflare stream code (so that TinyMCE wordpress editor doesn’t remove the tag automatically).

Furthermore, requesting manual/pre-set video quality adjusting (my videos are high-definitely PC tutorials, so a low-def video makes no sense).

Finally, integrating Signed URLs with the Wordpress plugin would be fantastic. I have no idea how to do this with code (to prevent pirating of the videos).

Once this has been implemented, this will potentially replaces the secure Flash RMTP permanently.

Thanks again.

1 Like

Hello, we need the video width and height in the “Video Details” API response. Can you add it please ?

We need a way to download the video on mobile for offline viewing. Any plans on this?

Hi all,

I think i found a bug today. I’m developing an app using stream API and uploading videos with tus js library (uppy). I uploaded a video for the test (“xxx.mp4”) and deleted it. When i tried to same video file with same name, tus upload result seems “success” but i cant see video on stream control panel or API video list. And upload result always gives same media id. If i change the video name and try upload again, everything works normally.


Hello Leo, I have the same issue :slight_smile: Can I know the plugin name? I only found the CF plugin from WP-engine, is that one that you are using? That plugin only works with gutenberg and I am struggeling as I use TinyMCE too !
(and same for signed URLs…)
Pls write me an email, maybe we can share the budget to make a coder creating a small script in wordpress for our websites that do the signed urls thing :=)

A post was split to a new topic: Tag & script issue