Is it possible to use a load balancer with multiple zones?
If yes, how would each server in the pool know which zone was hit when responding to the request?
So here’s the use case:
Let’s say I have a couple of VPS distributed around the world. I create a load balancer and a pool for
domainA.com. The domain is added to Cloudflare, but the servers in the pool are only IPs. I don’t need SSL between Cloudflare and the origin servers, but I do need it between Cloudflare and my users.
Now I want to add
domainC.com, etc, for my customers as new zones in our account or using the SSL for SaaS service. Could these also use the same load balancer with the configured pool?
Let’s say all this is working. Now my VPS are receiving the requests from the load balancer. How would I know which was the original request that was made? Does Cloudflare include the original URL into a header or can this be configured in some way?
Eg: User requests
domainB.com/hello.html it goes to the load balancer which requests to
18.104.22.168/hello.html. How would I know in my server it’s
Cloudflare includes the original visitor IP address in the X-Forwarded-For and CF-Connecting-IP headers.
If I understood well, the answer to your questions is here
Yes, you do. Otherwise SSL is pointless altogether.
Hmm but I wouldn’t need the IP of the visitor. What I’d need is to know which domain/zone it accsed before the load balancer.
I wouldn’t need it for my use case, but let’s just assume I have SSL at the origin.
Have you checked the docs ?
Session affinity, you could do that by the logs of healthy, unhealthy // healthchecks --> https://developers.cloudflare.com/load-balancing/understand-basics/session-affinity/
Try that, I am not 100% sure, but you could check the Analytics
I don’t really know what do you mean by that, can you add some more context?
I want to accept multiple domains through a load balancer that has a pool with multiple servers.
How do I know which domain did the request originate from when the request reaches the final server after passing through the balancer?
I’m still not getting through, but let me see if I got it.
domainA --> request-->Hits the Balancer --BalancerSend to:--> server2 accepted -->logsOfserver2//bydomainA
domainB--> request-->Hits the Balancer --BalancerSend to:--> Pool-server1 accepted -->logsOfserver1//byDomainB
Are we ok until here on the architecture or am I missing something?
I can understand maybe its more complicated than that, if it is, help us to understand more your thoughts
Yes, it’s more or less that.
But what I’d like to solve is showing different content depending whether the user comes from domainA or domainB, not so much storing a log.
hmmm, I think in that case, you should set that up on the application level, right?.
But again something is missing in your question.
Will you have subdomains, or different domains?
If its not logs the case , which platform will you use?
I think these are questions that you can do on the application layer, on the development and not so much on the server (well of course also on the server side, but more straightforward).
If I remember well WordPress can play quite easily for such a case, In any way, Cloudflare will pull and serve anything your app (and origin) give.
I hope its clear that.
Yes, obviously the logic to display different content would go into the application.
But to do that the application needs to know which domain the request comes from. Yes?
How does the application know that?
For example, Stackpath (a Cloudflare competitor) puts an HTTP header whenever it makes a request to origin with the original requested URL. So then the application can read that HTTP header and do something with it.
I am still confused,
How and why Cloudflare would change the original requested URL?
Have you ever tried Workers as we speak for HTTP headers?
Also to mention the ability to add custom headers option.
So what you’re saying is that even though the load balancer would request
SERVER_IP/hello.html the server would receive
This topic was automatically closed after 30 days. New replies are no longer allowed.