Hi guys,
I’m using Uppy.Tus for resumable upload to CloudFlare stream and it works like a charm, but I must send a header that contains my API_KEY for CloudFlare’s API authorize. Problem is everyone can view source and get that key. So how to prevent this?
Here is my code.
const uppy = Uppy.Core({debug: true, autoProceed: false})
.use(Uppy.Dashboard, {target: '#uppyUploader', inline: true})
.use(Uppy.Tus, {
endpoint: 'https://api.cloudflare.com/client/v4/accounts/{{ACCOUNT_ID}}/media',
headers: {
'X-Auth-Key': '{{API_KEY}}',
'X-Auth-Email': '{{EMAIL}}'
},
chunkSize: 5 * 1024 * 1024,
resume: true,
autoRetry: true,
retryDelays: [0, 1000, 3000, 5000]
})
.run();
uppy.on('upload-success', (file, response) => {
console.log(response); // HTTP status code
});
Thanks for help.