-2

I'm trying to get some urls images from an external resource.

Everytime I try I get a CORS error:

enter image description here

I have been looking for a solution but nothing seems to work. Tried the http-proxy-middleware library and some more. The last thing I tried was to add the proxy property to my package.json file:

  "version": "0.1.0",
  "proxy": "https://scontent-mad2-1.cdninstagram.com",
  "private": true,

but seems like it is not working neither.

Any ideas?

AngelQuesada
  • 387
  • 4
  • 19
  • That server is going to have to allow you access – Daniel A. White Sep 02 '23 at 12:04
  • 1
    Does this answer your question? [Enabling CORS in Create React App utility](https://stackoverflow.com/questions/47902840/enabling-cors-in-create-react-app-utility) – jabaa Sep 02 '23 at 12:08
  • Either you have to configure the server (add CORS response headers) or you have to use a proxy. You've configured the proxy, but it seems like you don't use it. – jabaa Sep 02 '23 at 12:09
  • http-proxy-middleware offers more extensive config options if you declare it in a .js file instead of package.json. You want to proxy requests to `*.cdninstagram.com` in your case. create-react-app (in case you're using it) has documentation on how to integrate with http-proxy-middleware. – timotgl Sep 02 '23 at 12:51

0 Answers0