itsthatguy / avatars-api-middleware

The express middleware for our avatars service
http://avatars.adorable.io
Other
749 stars 96 forks source link

Add Cross-origin resource sharing middleware #87

Closed laurentsenta closed 5 years ago

laurentsenta commented 5 years ago

At the moment, loading the image on a canvas and trying to export it (toDataURL) throws a tainted canvas error.

The solution is to use a "crossOrigin=anonymous" on the canvas, which requires a CORS on the API.

laurentsenta commented 5 years ago

Thanks for maintaining this API and serving it btw! I'm so eager to use it I forgot the basics. Happy holidays!

rylnd commented 5 years ago

Hey @lsenta! Sorry we didn't get to this sooner; I think the holidays caused us to miss it.

Responsibility-wise, this repository is only concerned with providing an express middleware; those server files you've modified are intended only to aid development of said middleware, and are not meant to be used in production (or by anyone that's not developing features on the middleware).

All that is to say that I don't think that these changes are necessary; if your server environment is throwing CORS errors, the intention is that you modify your own server's code to address them.

I hope that makes sense; please let me know if you have any further questions, or suggestions on how to prevent others from similar confusion in the future!

rylnd commented 5 years ago

Closing this due to inactivity.