Skip to content

Prepublish checks - Upload External Media: Failing due to CORS policy #69655

@MadtownLems

Description

@MadtownLems

Description

I've seen this mentioned a few times as responses to merge requests, but not as a dedicated issue, so I'm opening it here.

When I try to use the Prepublish Check -> Upload External Media feature, it fails:

Upload failed, try again.

The console shows:
Access to fetch '(remote url)' from origin (this site) has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.

I've seen reports most frequently with Google Docs images, but am experiencing it also with other sites we host.

For reference, some other reports were here:
#64741 (comment)
#46014 (comment)

Step-by-step reproduction instructions

For the sake of reproducing without exposing our site's URLs, I tried an image from google and got the same result.

  1. Add an image block, and set the source from URL to be:
    https://www.google.com/images/branding/googlelogo/1x/googlelogo_light_color_272x92dp.png

  2. Publish the Post. See that the External Media check flags this external media for uploading

  3. Click 'Upload'

  4. See that Upload failed, try again, with the same console error reported above

Screenshots, screen recording, code snippet

No response

Environment info

WP 6.7.2 and 6.8-Beta-3, with and without Gutenberg 20.5.0

Please confirm that you have searched existing issues in the repo.

  • Yes

Please confirm that you have tested with all plugins deactivated except Gutenberg.

  • Yes

Please confirm which theme type you used for testing.

  • Block
  • Classic
  • Hybrid (e.g. classic with theme.json)
  • Not sure

Metadata

Metadata

Assignees

No one assigned

    Labels

    [Feature] MediaAnything that impacts the experience of managing media[Package] Editor/packages/editor[Type] BugAn existing feature does not function as intended

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions