Solution 1 :

Your issue is on the Cloudflare side and not your code. You need to modify the Cloudflare resource CORS policy to allow requests from your domain.

However i’m not sure this is possible and you might have to use a CORS proxy.

Solution 2 :

You need to setup CORS for your bucket.

Currently, you have to use the S3 API PutBucketCors to configure CORS for your bucket.


Problem :

I’m Trying to upload my image to my cloudflare. But I got this CORS Error.

enter image description here

I think this error means cloudflare server do not allow me to upload my photo.

import "./styles.css";

export default function App() {
  const url =
  const direct_upload_url =
  const TOKEN = "H14yZzMAKcC0NS557jvExS1PjMqgVumgswEOUZ4h";

  const onChange = async (e) => {
    const file =[0];
    const formData = new FormData();

    for (let value of formData.values()) {
      console.log("val", value);

    try {
      const result = await fetch(url, {
        method: "post",
        headers: {
          Authorization: `Bearer ${TOKEN}`
        body: formData
      if (result) {
    } catch (error) {

  return (
    <div className="App">
      <h1>Hello CodeSandbox</h1>
      <input onChange={onChange} type={"file"} />

This is a code I used.

Please check my problem.