How do you configure a Cloudflare Worker to access Cloudflare R2?

Responsive Ad Header

Question

Grade: Education Subject: Support
How do you configure a Cloudflare Worker to access Cloudflare R2?
Asked by:
65 Viewed 65 Answers

Answer (65)

Best Answer
(340)
You configure a Worker to access R2 by including the R2 API key in the Worker's headers. This key is obtained from the Cloudflare dashboard. The Worker then uses this key to authenticate with the R2 API when accessing or modifying objects. Refer to the Cloudflare documentation for detailed instructions on setting up R2 access for Workers.