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:
application:name: my-app-1project: my-projectpublicly_accessible: trueport: 8080routers:- name: maincustom_domains:- branch: masterdomain: my.tld.comroutes:- application_name: my-app-1paths:- /
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:
application:name: my-app-1project: my-projectpublicly_accessible: trueport: 8080routers:- name: maincustom_domains:- branch: masterdomain: my.tld.comroutes:- application_name: my-app-1paths:- /
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:name: my-app-1project: my-projectpublicly_accessible: trueport: 8080routers:- name: maincustom_domains:- branch: masterdomain: my.tld.comroutes:- application_name: my-app-1paths:- /
application:name: my-app-2project: my-projectpublicly_accessible: trueport: 8080routers:- name: maincustom_domains:- branch: masterdomain: my.tld.comroutes:- application_name: my-app-2paths:- /app2/
Behind the scene Qovery will merge the two .qovery.yml into a single one. Which gives a router that will look like this:
...routers:- name: maincustom_domains:- branch: masterdomain: my.tld.comroutes:- application_name: my-app-1paths:- /- application_name: my-app-2paths:- /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