Tools
CORS generator for S3, R2, B2, Wasabi and Spaces
Pick your provider and your domains, and copy the CORS rule with the steps to add it. Free, no sign-up.
What this rule does
When a website uploads or downloads files straight from your bucket, the browser first asks the provider whether that domain is allowed. The CORS rule is the answer: which domains can do it, with which methods and which headers they see.
The generated rule only allows the domains you enter, exposes the ETag header for multipart uploads and lets the browser cache the answer for an hour.
Frequently asked questions
What is CORS on a bucket?
It is the list of websites that can request files from your bucket in the browser. If your domain is not in a rule, the browser blocks the upload or download even when the URL and the key are right. It does not affect desktop apps or the CLI, which skip that check.
Why do browser uploads fail when the key is right?
Because before uploading, the browser sends a check request and the provider answers according to your CORS rule. If the domain, the method or the headers are not allowed, the browser stops the upload and the console shows a CORS error, not a permissions one. Also check that the domain matches exactly: with https and no trailing slash.
Can I use * as the domain?
Yes: if you enter * on a line, the rule allows any domain. It is handy for testing, but in production it is better to list only your domains, so other websites cannot use your bucket from their visitors' browsers.
How long does the rule take to apply?
Usually a few seconds. Cloudflare says R2 can take up to 30 seconds, and other providers take about a minute. The browser also caches the answer for up to an hour, so if you tested earlier with a rule that failed, reload without cache or open a private window.
Sources
Steps checked against these pages.