nitin42 / react-imgpro

📷 Image Processing Component for React

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Issues loading image on https domain.

dbader87 opened this issue · comments

I'm receiving the error:

Mixed Content: The page at 'blob:https://mysecuredomain.com/053ee38d-3f6c-4498-8b44-78164f266038' was loaded over HTTPS, but requested an insecure XMLHttpRequest endpoint 'http://cors-anywhere.herokuapp.com/https://mycdn.com/1535123777.png'. This request has been blocked; the content must be served over HTTPS.

This issue seems to be caused by using cors-anywhere on http on an https domain. Is there somewhere to configure cors-anywhere to use https?

I believe this is also causing jimp to throw an exception:

Uncaught Error: Uncaught, unspecified "error" event. ([object ProgressEvent])
at Jimp.EventEmitter.emit (jimp.min.js:27)
at Jimp.emitMulti (jimp.min.js:27)
at Jimp.emitError (jimp.min.js:27)
at jimp.min.js:27

Thanks for your time.

Make sure the server is CORS enabled , the one from which you are serving the images. For a workaround in development, you can use a chrome extension for CORS.

I have a proxy I can use on my server. Would it be possible to change the cors-anywhere protocol?

Thanks for your time.

Ok so I didn't want to go the CORS route and I found the root of the issue. The CDN you are including for jimp:

https://cdn.rawgit.com/nitin42/5fef1095f281aa0cdf36ad6e5c460c9a/raw/359af525cb063ac002ebcf39274fb6c7d12e2f3e/jimp.min.js

references http://cors-anywhere.herokuapp.com which throws the above error. I tried using a custom CDN via the customCdn prop and had no success. After modifying your minified source directly and replacing the CDN above with a new jimp.min.js referencing //cors-anywhere.herokuapp.com then everything was working.

Awesome! I'll update the docs 😄 thanks 👍

Hi @dbader87 how did you exactly solved this?