Redirect to specific origin with load balancing?
I've been reading the documentation for load balancing because it's a service I'm considering purchasing in the near future for a project, I'd be interested in Geo steering for pools and Random steering for origins. However, I would also like to provide the option for a user to send their request to a specific origin, ideally through something like a request header or a query string, bypassing load balancing. Would it be possible to do this through configuring load balancing or would I have to make that user use a different URL for their request, and use subdomains for different origins or something?
29 Replies
Check out Origin Rules 👍
The reason I ask if it's possible to do through configuring load balancing is so that request is taken into account when distributing requests, otherwise a user could slow down a server by bypassing load balancing and the load balancer wouldn't know any better
Load Balancing itself is more for doing exactly that, balancing the load over multiple handlers. It only has a small subset of rules that it can apply to traffic, and it looks like Query String is one of the operators.
sorry, let me give you the full screenshot context there
oh that looks perfect thank you
I was just reading the traffic steering documentation and didn't see any way to create custom rules like that
there's more options but i don't want to send a gazillion screenies
and i do believe you can add more custom rules to a LB, or we might be able to expand it.
just one should be enough for this but it's good to know that option is available
heck it
that's all the options for incoming request attributes 👍
awesome, thanks
you bet
here when it says "terminates" as the override, could you clarify what that means please?
terminates the load balancer and forwards the request, or terminates the request?
that's the end of the custom rule. https://developers.cloudflare.com/load-balancing/additional-options/load-balancing-rules/actions/
https://developers.cloudflare.com/load-balancing/additional-options/load-balancing-rules/reference/ for fields reference. largely the same as WAF Custom Rules
based on those possible actions, there doesn't seem to be a way to redirect to a specific origin, unless i'm missing something?
Origin pool override, like my very first screenshot.
If the request matches <your selections> override the LB logic with <origin pool you pick>
so to go to a specific origin I'd create an origin pool with just one origin in it?
can an origin be in multiple pools?
If you want the option to select one specific origin, then yeah it looks like it'd have to be in its own pool.
and I do believe you can have the same origin in multiple pools.
For example, you could set pool1 for origin A, origin B, and set the origin weight to 50/50 random selection.
then you could do pool2 for Origin A and Origin C, 50/50 random.
Set the weight for both pools to 50%
Then Pool 3 can have its own, standalone origin server, with no weight, but you can still select it in the custom rule.
that seems to be my understanding of it at the moment.
yeah, like this.
I've just realised the limit for the number of pools is 20, the same as the number of origins. I was originally going to create pools based on geographical regions and then use random to spread the load, but I think now it makes more sense to just have each origin in its own pool and then use dynamic traffic steering. if i'm reading the docs right RTT should take into account both geographical region and if the server is running slower because of increased traffic (outside of the server actually slowing down because its at full capacity there is no advantage to me to having an even number of requests across all origins. Geographic region is the most important factor and then if the origin is struggling then requests should go elsewhere which is what dynamic seems to do because round trip time would increase if the server was behind right?), and having each in its own pool gives me the option to redirect to any specific origin
don't use my screenshot as evidence, i have custom entitlements
the base LB plan comes with two origins
oh no i used the docs for that
ah
yeah, 20 LBs and 20 pools i think is the default, and you can choose how many origins, up to 8 i think
nice
i believe it's $5 a month for 2 origins and then $5 per additional origin per month up to 20
5 bucks per origin after 2 iirc, check the LB pricing page or the dash, when you click "Enable" it brings up a pricing options modal
and i doubt i will ever hit the limitation of 20 origins i'm not a big company yet i'm just a person lol
anyways thank you for your help and enjoy the rest of your day
possibly consider eating something for lunch as well as sleeping