CORS policy issue with Page Rules

Hi, and merry Christmas! :slight_smile:

I’m trying to render an image using JavaScript, but I run into CORS issues. Here is the context:

  • I use Cloudflare Images with my custom domain (…). If I use that, it works fine, and I’m able to render/download the image client-side using JavaScript, since it use the same domain.
  • I wanted to have a URL looking nicer than that, so I made a page rule redirecting… to
  • I added a DNS A record: Name: Image, Content:
  • The image is accessible properly, but when I try to download it using JS, I run into a CORS issue.

What could I do to fix that?

When you try to download what? The URL?

Yes :slight_smile:

But it works fine from the url

The URL doesn’t contain an image. It contains a redirect response to tell you where you need to go to get the image. I recommend that you modify your JavaScript to follow redirects. I don’t do much coding, so I’m not sure what that logic would look like.

This topic was automatically closed after 15 days. New replies are no longer allowed.