Cloudflare R2 icon

Cloudflare R2

Interact with Cloudflare R2 object storage. Upload, download, manage files and buckets. Supports batch operations, multipart uploads, and can be used as a tool by AI Agents.

Overview

This node allows interaction with Cloudflare R2 object storage, specifically managing buckets and their configurations. The "Get CORS" operation under the "Bucket" resource retrieves the Cross-Origin Resource Sharing (CORS) configuration for a specified R2 bucket.

Use cases include:

  • Inspecting the current CORS rules applied to a bucket to understand which origins, methods, and headers are allowed.
  • Debugging or auditing bucket access policies related to web applications that interact with R2 storage.
  • Integrating with workflows that need to conditionally adjust behavior based on existing CORS settings.

For example, a user might want to fetch the CORS configuration before updating it or to verify that a bucket is correctly configured to allow requests from certain domains.

Properties

Name Meaning
Bucket Name The unique name of the Cloudflare R2 bucket whose CORS configuration you want to retrieve.

Output

The output JSON contains a field named corsConfiguration which holds the CORS configuration details of the specified bucket. This typically includes an array of CORS rules specifying allowed origins, HTTP methods, headers, and max age for preflight caching.

Example output structure:

{
  "corsConfiguration": {
    "rules": [
      {
        "allowed_origins": ["https://example.com", "*"],
        "allowed_methods": ["GET", "POST"],
        "allowed_headers": ["Content-Type", "Authorization"],
        "max_age": 3600
      }
    ]
  }
}

No binary data is output by this operation.

Dependencies

  • Requires an API key credential for authenticating with Cloudflare R2.
  • Depends on internal utility functions to communicate with Cloudflare's R2 API.
  • No additional external services beyond Cloudflare R2 are required.

Troubleshooting

  • Invalid Bucket Name: If the bucket name format is invalid, the node will throw an error. Ensure the bucket name conforms to Cloudflare R2 naming rules.
  • Bucket Not Found: If the specified bucket does not exist or is inaccessible, the node may return an error indicating failure to retrieve CORS configuration.
  • API Authentication Errors: Misconfigured or missing API credentials will cause authentication failures.
  • Empty or Missing CORS Configuration: If no CORS rules are set, the returned configuration may be empty or contain an empty rules array.

To resolve errors:

  • Verify the bucket name is correct and exists in your Cloudflare account.
  • Check that the API key credential is valid and has sufficient permissions.
  • Confirm network connectivity to Cloudflare's API endpoints.

Links and References

Discussion