I want to use CropperJS with images fetched from Google image search API. For the most part this works OK, but some images trigger a CORs error:
Access to XMLHttpRequest at 'https://wgfd.wyo.gov/WGFD/media/content/PDF/Regional%20Offices/Green%20River/13-lined-gf-2.jpg?ext=.jpg' from origin 'http://dev.hylark.test:8080' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
CropperJS does warn about this but I want to try and work around this.
I found a package called CORS-anywhere which seems to do what I want, essentially setting up a self hosted reverse proxy that adds the necessary headers to the image response so it doesn't trigger the error in the browser.
I'm wondering why it isn't possible to just do this inside NGINX? I'm not too familiar with NGINX, but I know it can be used as a reverse proxy, and you can add headers to the response. I've tried a few things but I think I'm way off here so any insight would be helpful.