'Add a parameter to Strapi V4 request header

I am using Strapi V4 as my CMS and using ECS S3 as the media storage.

I am using https://www.npmjs.com/package/@strapi/provider-upload-aws-s3 as the provider upload plugin.

I am able to upload media assets to the bucket but get error 403 forbidden when I try to GET the assets from the bucket. I have done the necessary additions to plugins.js and middlewares.js files.

I am now trying to add a parameter "x-emc-namespace": "my-bucket-key" to the request header in the HTTPS call that Strapi API makes to the bucket.

I have tried the Strapi webhooks approach mentioned here but that didn't help in adding a parameter to the request header.

So, my question is how to add a parameter in the Strapi v4 request header.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source