-
Notifications
You must be signed in to change notification settings - Fork 10k
[r2] add troubleshooting #17623
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Oxyjun
merged 21 commits into
cloudflare:production
from
Le0Developer:feat/r2-troubleshooting
Apr 16, 2025
Merged
[r2] add troubleshooting #17623
Changes from 7 commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
a3b7eb0
add r2 troubleshooting
Le0Developer 1c53a3b
update wording to be friendlier and point to more docs
Le0Developer 36a6ff7
Update src/content/docs/r2/platform/troubleshooting.mdx
Le0Developer f414bb7
Update src/content/docs/r2/platform/troubleshooting.mdx
Le0Developer 3253211
worker -> client
Le0Developer 8a1c131
remove "fyi" of OPTIONS method
Le0Developer 5c67cfc
Update src/content/docs/r2/platform/troubleshooting.mdx
Le0Developer 76b6267
Update src/content/docs/r2/platform/troubleshooting.mdx
Le0Developer 8fdb9ec
Update src/content/docs/r2/platform/troubleshooting.mdx
Le0Developer 99cb155
Update src/content/docs/r2/platform/troubleshooting.mdx
Le0Developer af9bf67
Update src/content/docs/r2/platform/troubleshooting.mdx
Le0Developer 642439c
Update src/content/docs/r2/platform/troubleshooting.mdx
Le0Developer cf4219f
Update src/content/docs/r2/platform/troubleshooting.mdx
Le0Developer 92da945
Update src/content/docs/r2/platform/troubleshooting.mdx
Le0Developer 9793349
Update src/content/docs/r2/platform/troubleshooting.mdx
Le0Developer 58cda0b
Update src/content/docs/r2/platform/troubleshooting.mdx
Le0Developer 758f5da
Update src/content/docs/r2/platform/troubleshooting.mdx
Le0Developer 49a10eb
Update src/content/docs/r2/platform/troubleshooting.mdx
Le0Developer f1f3bd2
Update src/content/docs/r2/platform/troubleshooting.mdx
Le0Developer 5e1ccfb
Update src/content/docs/r2/platform/troubleshooting.mdx
Le0Developer c0d0b38
Update src/content/docs/r2/platform/troubleshooting.mdx
Le0Developer File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,62 @@ | ||
| --- | ||
| pcx_content_type: troubleshooting | ||
| title: Troubleshooting | ||
|
|
||
| --- | ||
|
|
||
| ## Troubleshooting 403 / CORS issues with R2 | ||
|
|
||
| If you are encountering a CORS error despite setting up everything correctly, you may follow this troubleshooting guide to help you. | ||
|
|
||
| If you see a 401/403 error above the CORS error in your browser console, you are dealing with a different issue (not CORS related). | ||
|
|
||
| If you do have a CORS issue, refer to [Resolving CORS issues](#if-its-actually-cors). | ||
|
|
||
| ### If you are using a Custom domain | ||
Le0Developer marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| Go to the Network tab and find the failing request (you may need to reload the page, since only requests after opening the developer tools are logged). | ||
| You need to check the response headers for the following two headers: | ||
Le0Developer marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| - `cf-cache-status` | ||
| - `cf-mitigated` | ||
|
|
||
| #### If you have a `cf-mitigated` header | ||
|
|
||
| Your request was blocked by one of your WAF rules. Inspect your [Security Events](/waf/analytics/security-events/) to identify the cause of the block. | ||
|
|
||
| #### If you don't have a `cf-cache-status` header | ||
Le0Developer marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| Your request was blocked by [Hotlink Protection](/waf/tools/scrape-shield/hotlink-protection/). | ||
| You need to tweak your Hotlink Protection settings using a [Configuration Rule](/rules/configuration-rules/) or you can disable it completely. | ||
Le0Developer marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| ### If you are using the S3 API | ||
|
|
||
| Your request is very likely incorrectly signed. | ||
| You may see a better error message by trying the request over curl. | ||
Le0Developer marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| You can find working S3 signing examples on the [Examples](/r2/examples/aws/) page. | ||
Le0Developer marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| ### If it's actually CORS | ||
Le0Developer marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| Here are some common issues with CORS configurations: | ||
|
|
||
| - `ExposeHeaders` is missing headers like `ETag` | ||
| - `AllowedHeaders` is missing headers like `Authorization` or `Content-Type` | ||
| - `AllowedMethods` is missing methods like `POST`/`PUT` | ||
|
|
||
| ## HTTP 5XX Errors and Capacity limitations of Cloudflare R2 | ||
Le0Developer marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| When you encounter an HTTP 5XX error, it's usually a sign that your Cloudflare R2 bucket has been overwhelmed by too many concurrent requests. | ||
| These errors can trigger bucket-wide read and write locks, affecting the performance of all ongoing operations. | ||
| To avoid these disruptions, it's important to implement strategies for managing request volume. | ||
Le0Developer marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| Here are some mitigations you can employ: | ||
|
|
||
| ### Monitor Concurrent Requests | ||
Le0Developer marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| Track the number of concurrent requests to your bucket. If a client encounters a 5XX error, ensure that it retries the operation and communicates with other clients. By coordinating, clients can collectively slow down, reducing the request rate and maintaining a more stable flow of successful operations. | ||
|
|
||
| If your users are directly uploading to the bucket (for example, using the S3 or Workers API), you may not be able to monitor or enforce a concurrency limit. In that case, we recommend Bucket Sharding: | ||
Le0Developer marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| ### Bucket Sharding | ||
Le0Developer marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| For higher capacity at the cost of added complexity, consider bucket sharding. This approach distributes reads and writes across multiple buckets, reducing the load on any single bucket. While sharding won't prevent a single hot object from exhausting capacity, it can mitigate the overall impact and improve system resilience. | ||
Le0Developer marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.