I first want to explain what is my current setup, to continue explaining why am I having questions on putting CloudFlare in the mix.
Currently I have many different domains that are set up to delegate traffic to a proxy. That proxy will (based on the original host name) do some changes in the request, make the request to another server and modify the response that comes back to finally deliver it to the client.
I want to be able to put Cloudflare right on top of the proxy so that I can take advantage of the caching and security offered by it. However, I want to make sure that this is a good approach and is something that Cloudflare can be helpful.
My concerns and questions are:
Currently for a given domain, for example www.sellingpens.com, once I get to the proxy, I will be directing the traffic to www.myapp.com/sellingpens - I can do that because I have access to the host name and part of it (sellingpens), so I know what suffix to put in there. If I put CloudFlare as the name authoritative of the proxy app, will I still have acess to the original hostname?
If I do a request to www.sellingpens.com which will ultimately get the response from www.myapp.com/sellingpens and cache it in Cloudflare (because it lives on top of the Proxy), if I do a request to www.sellingboots.com (which will ultimately get the response from www.myapp.com/sellingboots), will I be getting the cached response for sellingpens.com? If not, how does Cloudflare know how to differentiate between those two requests?
Is Cloudflare ok with supporting requests that comes from different domains? Right now I can do www.sellingpens.com which is told to delegate to www.myapp.com, and also I can do www.sellingboots.com which is told to delegate to www.myapp.com. If I put Cloudflare as the authoritative of www.myapp.com, will it be ok handling requests that come from different domains (sellingboots.com and sellingpens.com)?
Does this architecture make sense? I haven’t been able to find any question related to this, and I want to make sure that going from the flow of: domain -> proxy -> app to domain -> (cloudflare) -> proxy -> app, will still make sense.