first of all I am very new to the subject and the headline maybe wrong but here is what I would like to achieve:
Currently I have web server as origin which all clients connect to but as you can guess this is a very basic setup with no redundancy and also exposes my origin with all the data to the public.
What I want to do is, let's say I have web server in country A which is my origin and has all the contents. I have 3 nginx (free edition) servers in countries A,B and C which cache the contents of my origin plus they apply some simple rules to the requests.
Origin server IP : 1.1.1.1 Nginx A IP : 1.1.1.2 Nginx B IP : 1.1.1.3 Nginx C IP : 1.1.1.4
Load Balancer IP : 1.1.1.10
What I want to achieve is if a client wants to access the content from country A he should be forwarded to Nginx in country A, so on and so forth for other countries.
Also I would like to have a health check in place so if Nginx in country C failed traffic gets split into Nginx A and B.
What I understand is you can have a Nginx set up as load balancer (1.1.1.10) which has the other 3 Nginx(s) as upstreams and will get the content based on the rules you set (GEOIP or whatever) but my issue is then I would need a high BW server to do this load balancing because the actual packets are sent through this IP (1.1.1.10), am I correct here?
But what I actually want is if a client from country B accesses this url: http://1.1.1.10/app/image.jpg he should be forwarded to http://1.1.1.3/app/image.jpg
This example is in http but of course https is more desired. For example : https://www.example.com points to 1.1.1.10 https://srvB.example.com points to 1.1.1.3 so https://www.example.com/app/image.jpg from country B would be redirected to https://srvB.example.com/app/image.jpg
Is there any free solution to this ?
I know there are cloud based load balancers like cloudflare which do exactly this but I am trying to keep the cost as low as possible and most of them get pretty expensive when you have a large daily/monthly BW.
While I was reading about my problem I also stumbled upon forward and reverse proxy but I couldn't figure out how those could help me, if this is the solution to my problem can someone explain a bit about this ?