# Uppy + tus add unique headers per file

**URL:** <https://community.transloadit.com/t/uppy-tus-add-unique-headers-per-file/15048>\
**Category:** Uppy\
**Created:** [September 9, 2019, 8:29pm UTC](https://community.transloadit.com/t/uppy-tus-add-unique-headers-per-file/15048 "2019-09-09T20:29:41Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![gcm50](https://yyz2.discourse-cdn.com/flex032/user_avatar/community.transloadit.com/gcm50/32/157_2.png) [@gcm50](https://community.transloadit.com/u/gcm50)\
**Post date:** [September 9, 2019, 8:29pm UTC](https://community.transloadit.com/t/uppy-tus-add-unique-headers-per-file/15048/1 "2019-09-09T20:29:41Z")

</div>

Hello!

When utilizing Uppy with the tus plugin is possible to provide unique headers per file instead of simply setting them globally in the tus options?

For example, is it possible to include each files total file size as a custom header in all upload requests for that file (POST/HEAD/PATCH)?

Alternatively, is there an option to send the Upload-Metadata in each request instead of only sending it in the initial POST to create the upload?

Any help would be greatly appreciated! Uppy and tus have been a joy to work with :)!

---

<div class="post-metadata">

**Author:** ![gcm50](https://yyz2.discourse-cdn.com/flex032/user_avatar/community.transloadit.com/gcm50/32/157_2.png) [@gcm50](https://community.transloadit.com/u/gcm50)\
**Post date:** [September 9, 2019, 9:53pm UTC](https://community.transloadit.com/t/uppy-tus-add-unique-headers-per-file/15048/2 "2019-09-09T21:53:43Z")

</div>

After some more time investigating it appears there is a per file tus options override that is outlined in the tus upload method:  
 ![image](https://canada1.discourse-cdn.com/flex032/uploads/transloadit/original/1X/192fd3dae9bce5cf383ae8e48f499dc92869dda7.png)  
Utilizing this and the `onBeforeUpload` uppy option it appears you can override the headers per file like so:

```auto
onBeforeUpload: (files: any) => {
  const updatedFiles = Object.assign({}, files);
  Object.keys(updatedFiles).forEach(fileId => {
    updatedFiles[fileId].tus = {
      headers: {
        'FILE_SIZE': updatedFiles[fileId].size,
        'TEST_HEADER': 'test value'
      }
    };
  });
  return updatedFiles;
}

```

I would still be happy to hear any other suggestions or thoughts on this solution! Cheers!
