How do you push different versions of static files to CDNs based on the location?

github logo ・1 min read

Let's say I want people from different countries to see different versions of my website based of which country they are in.

Currently I parse the country from IP address in the back end and load the appropriate content.

However, this is slow as each request has to hit the server.
Is there a way to do this with CDN?

twitter logo DISCUSS (2)
markdown guide

There are various ways to accomplish this. If you're just serving a static site, you can manage separate deployments for each region, and then host those versions through a cloud provider.

Their regional load balancing services will basically just do this with limited configuration.

If you're just hosting a static site, most commercial cdns can direct regional traffic to a particular directory without much issue as well.


I see. Thanks for the direction. I'll look into the options.

Classic DEV Post from Aug 4 '17

Beginner's guide - Object Oriented Programming

Understand four pillars of OOP - Abstraction Encapsulation, inheritance and Polymorphism

Arijit Basu profile image