Routing Overview

The Routing layer of Now sits in between the internet and your deployments.

It is responsible for many things. But the most important one is routing requests for the URL of your deployment to the correct Lambda or Static File output of your Builds.

In order to route requests as fast as possible, the Routing layer is running in several locations across the world. In all of these locations (called Regions), you can create Deployments that create Builds outputting Lambdas and/or Static Files (the full list can be found here).

In turn, the Routing layer will automatically forward incoming requests to the closest location in which your Lambda is running (Static Files are always distributed across the whole network, thus not location-specific).

This also means that the Routing layer might forward your request to a completely different region, if the region in which it is running does not contain a Lambda of your Deployment.

In general, we recommend distributing your Deployments (which contain Static Files and/or Lambdas, depending on how your Builds are configured) to all regions. This will improve performance drastically, as visitors are automatically served by the Lambda that is running closest to their location.

In order to distribute your Deployment to all Regions when creating it, make sure to define the --regions flag in Now CLI and set it to all.

Note: When taking advantage of this behaviour of the platform, it is very important to understand that Now is not resolving the keyword `all` to all the available regions.

Instead, the keyword is stored as-is and instructs the platform to automatically create your Deployments in any other additional Region, should one of the existing ones experience downtime (you are not billed more for this automatic change, as the previous Region would be unreachable in that event – thus no invocations could happen).

Aside from routing your requests to the correct destination, the Routing layer also takes care of a few other important aspects of a working Deployment:

All of these actions are performed on-demand and with maximum performance (ensured by our choices of technology). In turn, we highly recommend not implementing any of those features into your own code, as it would be unnecessary.

At the moment, we only support HTTPS and WSS (this list will be updated in the event that support for an additional protocol is added to the Routing layer).