DNS Records and Deno

so I am confused I'm building an application that uses Steam's web API and am looking at why the response times are taking so long and with the perf headers I have in my application I can see it takes a while to make the requests (260-300 ms) so I investigated where Steam's API servers are located and found that there is one in Los Angeles so I spun up an EC2 instance there and pinged the domain name api.steampowered.com and the latency was still ~260 ms I used some online tools to find out that it's resolving the domain name to an IP that's located in Minnesota so I found the one for Los Angeles and the latency was ~0.5-5 ms which sounds correct, but using the api.steampowered.com domain still resolves to the wrong IP so I tried editing /etc/hosts and adding in the host myself to make it resolve to that IP address but based on the latency of the request it's still resolving to the Minnesota IP so I tried changing the IP to something other than a Steam API server to make sure that the manual DNS record was working and it is working, but it's also not working? doing ping on api.steampowered.com with the manually set DNS record works as expected, resulting in very low latency but doing fetch in Deno seems to resolve to a different IP address than what ping resolves to I can't just replace api.steampowered.com with the IP ( either because the server responds with a 400 Bad Request "Invalid URL" if I replace the domain name with an IP I've also made sure to restart the systemd-resolved service after changing /etc/hosts it is working, it's just that the API is much slower than I expected

Looking for more? Join the community!