tusd icon indicating copy to clipboard operation
tusd copied to clipboard

Dynamic base-path

Open alameenlr opened this issue 3 years ago • 3 comments

Question How to sent dynamic basepath? I've seen on this link https://developers.cloudflare.com/stream/uploading-videos/upload-video-file#nodejs-example

 var options = {
    endpoint: "https://api.cloudflare.com/client/v4/accounts/{ACCOUNT ID}/stream",
    headers: {
      'Authorization': 'Bearer $TOKEN',
    }
     ....
 }

They've added /{ACCOUNT ID}/stream on -base-path , How it is possible?... do you have any option for that?

Setup details Please provide following details, if applicable to your situation:

  • Operating System: Linux
  • Used tusd version: 1.0
  • Used tusd data storage: AWS S3
  • Used tusd configuration: [-s3-bucket,-s3-endpoint,-s3-object-prefix,-max-size,-timeout,-port,-hooks-http,-hooks-http-retry,-hooks-http-backoff,-hooks-enabled-events ,-behind-proxy]
  • Used tus client library: tus-js-client

alameenlr avatar May 18 '21 13:05 alameenlr

This is not possible with standalone tusd. I am not sure how Cloudflare does it since I am not sure whether they are using tusd or some other tus server. However, in theory you can use a reverse proxy before tusd to rewrite the dynamic URL into a "static" URL pointing to tusd. In addition, the proxy could store the account ID for the URL in a header, which can then by consumed in the hooks for tusd. At least, I think this should work.

Acconut avatar May 18 '21 13:05 Acconut

I have a similar issue. I put put tusd behind ambassador, rewrite the url there, and extract the dynamic parts to put in headers for hooks. But the location header which is returned from POST /upload is then wrong. Would be solved by supporting #332?

erlendvollset avatar May 21 '21 18:05 erlendvollset

I don't think #332 would help. Since you are already rewriting the URL using a proxy, the easiest approach is likely to also use the proxy to rewrite the Location header.

Acconut avatar May 25 '21 11:05 Acconut

Closing this issue due to inactivity. Feel free to leave a comment if you want to continue the discussion :)

Acconut avatar Mar 14 '23 11:03 Acconut