Skip to main content
A load balancer on Square Cloud is the same custom domain on more than one application. The Square Cloud edge splits the requests for that domain across the applications and stops sending them to one that goes offline. There is no separate balancer to create or maintain: setting the same domain on a second application turns it on.

Why use it

Round-robin at the edge

Each request goes to the next application in the group, so the load is split evenly, with no proxy or extra layer for you to configure.

Automatic failover

When an application goes offline, its requests are answered by the other applications in the group. Once it responds again, it is back in rotation by itself.

Updates without an outage

Restart or deploy one application at a time: while one comes back, the others keep serving the domain.

Included in your plan

No per-request billing and no add-on to buy. Load balancing comes with custom domains, from the Standard plan.

How it works

Visitors reach the Square Cloud edge, which splits the requests across the domain’s applications and skips the one that is down.
  • Round-robin, no sticky sessions. Each request can land on a different application. Sessions and caches kept in memory need shared state, such as a database or Redis.
  • Failover on refused connections. When an application is down, the request goes to another one in the group, POST included. If the response is the timeout page, only GET and HEAD are resent; a POST returns the error for the client to retry.
  • One hostname, the same site. Every application in the group answers on the same domain and should serve the same site or service: usually the same application deployed several times.
  • Back in rotation by itself. Once an application responds again, it starts receiving requests again, with no action on your part.

Applications per domain

How many applications can serve one domain depends on your plan: Adding an application past the limit is refused with LOAD_BALANCER_LIMIT_REACHED.

Create a load balancer

1

Deploy the site as two or more applications

Upload the same project once per application, each with its own SUBDOMAIN in the configuration file. Only websites join a balancer: an application without a subdomain can’t serve a domain.
2

Set the custom domain on the first application

Open the application’s network settings, set your domain and create the DNS records the dashboard shows at your DNS provider. The TLS certificate is issued and renewed for you. See how to set up your own domain.
3

Add the same domain to another application

Open Load Balancers in the dashboard, pick the domain and click Add application, or set the same domain in the second application’s network settings.
4

Check the group

The Load Balancers page shows the domain as Active balancing, with each application and its share of the traffic.
An application serves one custom domain at a time. Adding an application that already serves another domain moves it to the new one.

From the terminal or the API

Set the same domain on each application:
Then list the groups of your account:

Prepare your application

Requests for the same visitor can land on different applications, so each one must answer the same way:
  • Keep state outside the process. Store sessions, carts and caches in a database or Redis, not in memory.
  • Keep files outside the application. Each application has its own disk: send uploads to Blob Storage, so every application serves the same files.
  • Same code, same configuration. Deploy the same version to every application and give them the same environment variables.
  • Scheduled jobs run once per application. A job that must run a single time (a daily e-mail, a cleanup) needs a lock in the database, or belongs in only one application.

Update without an outage

Restart or deploy one application at a time. While it restarts, the edge sends its requests to the others; once it responds again, it is back in rotation. Updating every application at the same moment leaves the domain with nobody to answer.

Remove an application or the domain

  • Remove one application: on the Load Balancers page, choose Remove from balancer, or remove the domain in that application’s network settings. The other applications keep serving the domain.
  • Remove the domain: removing it from the last application releases the domain completely.
From the terminal, squarecloud app network domain @ --app <application ID> removes the custom domain of one application.

Frequently asked questions

It is one custom domain served by more than one of your applications. The Square Cloud edge sends the requests for that domain to those applications in round-robin and stops sending them to an application that goes offline.
Every plan with custom domains: Standard balances up to 2 applications per domain, Pro up to 5 and Enterprise up to 10. The Hobby plan does not include custom domains.
No. Load balancing is included in your plan, with no per-request billing and no requests-per-second ceiling set by the balancer.
No. Each request can land on a different application. Applications that keep state in memory (local sessions, a local cache) need shared state, such as a database or Redis.
If the application is offline (connection refused), any request, POST included, is answered by another application in the group. If the response is the timeout page instead, only requests without a body (GET, HEAD) are resent; a POST receives an error and must be retried by the client.
No. There is no autoscaling: you decide how many applications serve the domain, and add or remove one at any time.
No. Each application keeps its own squareweb.app subdomain. Balancing applies to a custom domain shared by the applications.
Any website applications of the same account. They should serve the same site or service, since every one of them answers on the same hostname.