Set up a load balancer
1
Prepare your target apps
Deploy the web apps or APIs that will serve the traffic. Each target needs public web access and a
*.shardweb.app subdomain. Run the same service on each target that serves a given host.2
Create the load balancer
Open Load balancers in the dashboard, click Create load balancer, and give it a name.
3
Add applications
Click Add application and choose each target. Use Main route for a shared pool, or create a named route for a specific service.
4
Connect a host
Click Connect host, choose the route, and attach your domain or subdomain. For a domain with DNS managed by Shard Cloud, the dashboard can create the required records. For external DNS, copy the records shown in the dashboard to your DNS provider. A hostname can be attached to one application or load balancer at a time.
5
Verify traffic
Wait for the host’s DNS status to become active, then open the HTTPS URL and verify that the service responds.
Route domains to specific apps
A host on Main route can send traffic to every enabled target on the load balancer. Assign a host and its target apps to the same named route to limit which apps receive the host’s traffic. For example, putapi.example.com and your API replicas on an API route, and www.example.com and your frontend replicas on a Frontend route.
Maintain your targets
For a rolling release, pause one target, deploy and verify it at its own app URL, then enable it before updating the next target. Keep an enabled target for each host. While a host is connected, the load balancer requires at least one enabled target. Changes such as pausing a target or removing a host can take a few minutes to reach all traffic. Keep shared data such as sessions, uploads, and application state in a shared database or storage service when requests may land on different apps.Load balancer settings
- Response timeout controls how long the load balancer waits for a target before trying another. The default is 10 seconds. The dashboard accepts 1–30 seconds.
- Custom error page lets you upload HTML to show when no target on a route can respond.