Images are not rendered due to CORS issue
See original GitHub issueDescribe the bug I am not being able to load some of the images (specially images with large dimensions). Even this image doesn’t work. https://via.placeholder.com/720x400.png
<Image
style={styles.image}
src="https://via.placeholder.com/720x400.png"
/>
To Reproduce Steps to reproduce the behavior including code snippet (if applies):
- Go to ‘https://react-pdf.org/repl’
- Replace the local image with the remote link -> https://via.placeholder.com/720x400.png
- Notice that you won’t be able to see image.
- However, when you use CORS addons like CORS Everywhere, the image shows up.
You can make use of react-pdf REPL to share the snippet
Expected behavior We should be able see the remote image rendered in PDF.
Desktop (please complete the following information):
- OS: [MacOS]
- Browser [chrome, safari, firefox]
- React-pdf version latest
Issue Analytics
- State:
- Created 3 years ago
- Comments:11 (1 by maintainers)
Top Results From Across the Web
Dealing with image CORS error in Chrome, Chromium and ...
The issue comes from the way that Chromium caches the images. The way that the initial image is cached is - without the...
Read more >Allowing cross-origin use of images and canvas - HTML
HTML provides a crossorigin attribute for images that, in combination with an appropriate CORS header, allows images defined by the <img> ...
Read more >Images not loading due to CORS, depending if you v...
Images in reports published to the PowerBI service are no longer rendering if you visit via different URL prefixes; either app.powerbi.com or www.powerbi....
Read more >Html <img src=...> works but JS Image loading cause CORS ...
I try to found solution my self (JS ES6) but find only-partially. We are able to load img from no-CORS support src into...
Read more ><img crossorigin=""> » - HTML
Adding appropriate request headers for images is as simple as adding the crossorigin attribute to the <img> element. If your browser supports CORS,...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
If you are using AWS S3, make sure your bucket has a proper Cross-origin resource sharing and you are setting the random query string mentioned above https://docs.aws.amazon.com/AmazonS3/latest/dev/cors.html#how-do-i-enable-cors Example CORS policy:
Document:
maybe that helps