Provide access S4 buckets via a Cloudflare Worker, so that objects in the bucket may only be publicly accessed via S4.
Make sure you have Git and Node.js installed before proceeding.
To generate using wrangler
git clone https://github.com/meganz/s4-cloudflare s4-cloudflare
cd s4-cloudflare
Install wrangler and the rest of the dependencies
npm install
AWS_ACCESS_KEY_ID = "your S4 access key id". AWS_SECRET_ACCESS_KEY = "your S4 secret access key". AWS_DEFAULT_REGION = "Prefered Region" # By default g". AWS_S3_BUCKET = "YOUR-BUCKET". routes = [ { pattern = "YOUR-CUSTOM-DOMAIN", custom_domain = true } ].
if you want to allow clients to list objects, otherwise false. ALLOW_LIST_BUCKET = "true".
Must be logged in to his cloudflare account.
npx wrangler deploy
To deploy using serverless add a serverless.yml
file.