Proxy api.mydomain.com

Can i use cloudflare to proxy my api so i can use WAF rules, DDOS protection and so on? For html content i can understand how it work with cloudflare. If cloudflare doesn't have the requested resource, cloudflare request origin server for this resource then cache it or not (depending on the various caching rule and header) But for api where it's only dynamic i'm not sure i get it. First is it allowed? and cloudflare would just forward the request to origin server and then when my origin server respond, would respond back to the client ? And this for every api requests? If it's allowed do you even need a load balancer? if cloudflare proxy is doing most of the same work?
4 Replies
zegevlier
zegevlier17mo ago
That is totally allowed, and you don't need to purchase anything seperate for it.
kraftriver
kraftriverOP17mo ago
That's so cool. And does cloudflare pick the closest origin server from the requester? For example, if i have 100 A records which are all from different locations.
zegevlier
zegevlier17mo ago
No, it would pick a random one each time. For that you would have to use a load balancer with geo steering
kraftriver
kraftriverOP17mo ago
Ok it would have been too beautiful ;). What about websocket. If api.mydomain.com want to establish a websocket connection with the client like it's commonly used in application today (for real-time notification, update, communication...). It's cloudflare which maintain this websocket connection with the client? And because for websocket connection, you usually need to have the same server, does cloudflare maintain the connection with my server as well ?
Want results from more Discord servers?
Add your server