As most CDN claims they can serve your static content faster based on user's location, I wonder how they actually do that.
For example if I have a HTML like this:
<html>
<head> title </title>
<body>
</h1>Hello world</h1>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/18.0.0-alpha-464f27572-20210713/umd/react.production.min.js" integrity="sha512-ajIHzHkfQaAO507V8rEsyK4ftf96GFD7TC4znUxoKaRr7D0U/qmRDCXAXpc5DmmwoUnHcNtx6gaz14R0PHtRrg==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
</body>
</html>
How does the CDN provider know that I am located in UK and should connect to, say AWS West Europe? Do they have special DNS settings? What techniques do they employ to make my browser know that where it should request the resource?
One of my guesses would be that they have a server that reads the user's IP and re-direct accordingly but that does not make sense because if the server is located in Hongkong and I am in New York, that round trip would take most of the time of the latency. So I am guessing they must have some ticks to resolve this issue on the DNS level.
I have searched through the internet but could not find any explanation. Could you explain this to me?
