Report this

What is the reason for this report?

Load Balancer WIldcard but with one subdomain going to a different droplet

Posted on October 11, 2021

Right now I’m using an nginx VPS to terminate SSL (wildcard and naked domain), but to forward one specific subdomain to a different server. It works fine.

I’m wondering though if I can leverage DO’s load balancers for this instead of managing it myself.

I have a group of servers for my main app, which responds to a lot of different subdomains (like a thousand or so, one for each customer). I.e. a.example.com, b.example.com, etc.

I have a second group of servers running a different application which needs to respond to one specific subdomain (legacy.example.com).

I get how to configure the DO load balancers to handle #1 or #2 in a vacuum, but I can’t find a way to do both.

To summarize, what I need to do is:

  1. SSL Terminate *.example.com (via letsencrypt wildcard managed by the LB).
  2. Proxy just legacy.example.com to Droplet B.
  3. Proxy everything else *.example.com to Droplet A

So is there a way to write custom rules for the LB to handle this? Would having 2 LBs handle this? Or do I just stick with my current nginx VPS setup?

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Start building today

From GPU-powered inference and Kubernetes to managed databases and storage, get everything you need to build, scale, and deploy intelligent applications.