Home > Software engineering >  Getting around CORS by forwarding from the back-end
Getting around CORS by forwarding from the back-end

Time:07-01

I'm implementing an internet speed test in my Angular app, and I'm using fast.com to test the speeds. The problem is that it takes 2 calls: The first call to https://api.fast.com/netflix/speedtest/v2 returns 5 URLs that should be called. Each of these URLs are chosen based on their CDN geolocation to you the client, and availability.

Unfortunately, this call does not return CORS headers, but the subsequent 5 URLs do. I've gotten around this by having my back-end make the first call, but the URLs will always be generated based on the location of my server.

Is there a way to forward a request from the back-end so that the service sees the original IP address? Or is there a fast.com param/header I can include from my back-end call?

CodePudding user response:

You could attempt to use the X-Forwarded-For header, which is the de-facto standard header for doing requests like this.

(I'm not 100% sure if Fast.com supports this, but this might be worth a try)

  • Related