← All Articles

One Domain, Many Services: Path-Based Routing for Deploy v3

Vic van GoolVic van Gool
Aug 3rd 26
Deploy v3
Networking
Product Updates

Traffic sources in Deploy v3 now take an optional URL path alongside the domain. Several services in the same application can share a single domain, split by path: example.com serves your web service, example.com/app your dashboard, and example.com/api your API. One domain, one certificate, as many services as you need.

No more handing out a subdomain per service just to get traffic to the right place.

Setting it up

Open your cluster, go to Traffic, and click New Traffic Source. The drawer asks for a domain name, an optional path, the destination service, and an SSL certificate. That's the whole setup.

Leave the path blank and the traffic source behaves exactly as it always has: every request for that domain goes to the service you picked. Fill it in — /app, /api — and only requests to that path reach that service.

How paths are matched

Matching is segment-exact, which is exactly what you'd want it to do. A traffic source on /api matches /api and everything beneath it, such as /api/v2/orders. It won't match /api-internal or /apiary, which a plain string prefix would have swallowed.

The matched path is removed before the request reaches your service. A request to example.com/api/orders arrives at the API service as /orders, so your service never needs to know which path it's mounted under, and you can move it later without touching a single route.

The rules

A domain belongs to a single application. Its paths can point at different services, but all of them have to live in the same application, which keeps ownership of the domain's SSL certificate unambiguous. Each domain and path pair must be unique within a cluster.

Paths need a service that exposes an external HTTP or HTTPS port. TCP and UDP traffic is matched on the domain alone. The rules and limitations are written up in full in the docs.

Existing applications

Nothing changes until you add a path, so there's nothing to migrate and nothing to plan around. Traffic sources without one keep matching on the domain exactly as before.

Services created before this release are updated automatically the first time you save a path against one.

Try it

Path-based routing is live on every Deploy v3 cluster right now. Pick a service, give it a path, and collapse a handful of subdomains into one. The full guide is in routing by URL path.


Try Cloud 66 for Free, No credit card required