Routing

Qovery allows you to define the routes used in your environments.

A route describes how an incoming HTTP request is going to be processed by Qovery. The routes are defined using .qovery.yml file in your application repository.

Concepts

Router

Qovery has the concept of "router" which is where the traffic transit from the World and your application. Each application that needs to be accessible from outside - needs to be attached to at least one router.

An application can be attached to 0 to n routers. It's up to you and depends on your use case.

A router is defined by:

  • a name (must be unique through the project)
  • 0 to n custom domains
  • 1 to n routes

Here is a configuration example of a router:

.qovery.yml
application:
name: my-app-1
project: my-project
publicly_accessible: true
routers:
- name: main
custom_domains:
- branch: master
domain: my.tld.com
routes:
- application_name: my-app-1
paths:
- /

Route

A "route" is a concept to connect a "router" to an application. An application can have 0 to n routes.

A route is defined by:

  • a path
  • an application name

Here is a configuration example of a route:

.qovery.yml
application:
name: my-app-1
project: my-project
publicly_accessible: true
routers:
- name: main
custom_domains:
- branch: master
domain: my.tld.com
routes:
- application_name: my-app-1
paths:
- /

Multiple routes

As explained above, each router can have multiple routes targeting different applications. Each application can use the same router by using the same router name within the same project.

Here is an example with two applications, which each of them have their own .qovery.yml file.

Application 1 - .qovery.yml
application:
name: my-app-1
project: my-project
publicly_accessible: true
routers:
- name: main
custom_domains:
- branch: master
domain: my.tld.com
routes:
- application_name: my-app-1
paths:
- /
Application 2 - .qovery.yml
application:
name: my-app-2
project: my-project
publicly_accessible: true
routers:
- name: main
custom_domains:
- branch: master
domain: my.tld.com
routes:
- application_name: my-app-2
paths:
- /app2/

Behind the scene Qovery will merge the two .qovery.yml into a single one. Which gives a router that will look like this:

Merged router
...
routers:
- name: main
custom_domains:
- branch: master
domain: my.tld.com
routes:
- application_name: my-app-1
paths:
- /
- application_name: my-app-2
paths:
- /app2/

Meaning, traffic with a route starting with the URL https://my.tld.com/app2 is routed on my-app-2, and the remaining traffic is routed on my-app-1.

Custom domains

A custom domain can be attached (optional) to a "router" and an environment. Then, multiple application can benefit from the same domain.

Example

Check out our guide to see an example