|
1 | 1 | --- |
2 | 2 | title: Domains |
3 | | -description: "Add custom domains to Coolify with FQDN format, multiple domain support, port mapping, wildcard domains, and custom DNS server validation." |
| 3 | +description: "Add custom domains to Coolify with FQDN format, multiple domain support, port mapping, path-based routing, wildcard domains, and custom DNS server validation." |
4 | 4 | --- |
5 | 5 |
|
6 | 6 | # Domains |
@@ -39,6 +39,44 @@ If automatic certificate issuance from [Let's Encrypt](https://letsencrypt.org?u |
39 | 39 | If you see a certificate warning in your browser or your application shows a self-signed certificate, see the [Let's Encrypt Not Working](/troubleshoot/dns-and-domains/lets-encrypt-not-working) troubleshooting guide for detailed solutions. |
40 | 40 | ::: |
41 | 41 |
|
| 42 | +## Path-Based Routing |
| 43 | + |
| 44 | +You can route traffic to different applications and services based on URL paths by appending a path to your domain. This allows multiple applications to share the same domain while being accessible at different paths. |
| 45 | + |
| 46 | +**Format**: `https://domain.com/path` or with a custom port: `https://domain.com:3000/path` |
| 47 | + |
| 48 | +::: warning PORT PLACEMENT |
| 49 | +When using both a port and a path, the port must come **after** the domain but **before** the path. |
| 50 | + |
| 51 | +- Correct: `https://coolify.io:3000/api` |
| 52 | +- Incorrect: `https://coolify.io/api:3000` |
| 53 | +::: |
| 54 | + |
| 55 | +### How Path Priority Works |
| 56 | + |
| 57 | +Coolify automatically applies priority rules to path-based routing. More specific paths take precedence over less specific ones: |
| 58 | + |
| 59 | +- `/api/v2/users` → highest priority |
| 60 | +- `/api/v2` → medium priority |
| 61 | +- `/api` → lower priority |
| 62 | +- `/` → lowest priority (root/fallback) |
| 63 | + |
| 64 | +This means you can safely deploy multiple applications on the same domain without worrying about routing conflicts. |
| 65 | + |
| 66 | +### Health Requirements |
| 67 | + |
| 68 | +For path-based routing to function correctly, the application serving a specific path must be **running and healthy**. If an application becomes unhealthy or stops responding, traffic to that path will fall back to the application serving the root domain (`/`). |
| 69 | + |
| 70 | +::: tip EXAMPLE |
| 71 | +If you have: |
| 72 | +- App A serving `https://coolify.io/` (root) |
| 73 | +- App B serving `https://coolify.io/api` |
| 74 | + |
| 75 | +And App B becomes unhealthy, requests to `/api` will be routed to App A instead. |
| 76 | +::: |
| 77 | + |
| 78 | +Read more about how Coolifys proxies read and intepret the health of your resources in our [Health Checks page](/knowledge-base/health-checks). |
| 79 | + |
42 | 80 | ## Catch Multiple Domains |
43 | 81 |
|
44 | 82 | Multitenancy is supported with Coolify. When using [Traefik](/knowledge-base/proxy/traefik/overview), you can automatically catch multiple domains, by editing the `Container Labels` of your Application or Service and define a [`HostRegexp`](https://doc.traefik.io/traefik/reference/routing-configuration/http/routing/rules-and-priority/#host-and-hostregexp) rule. |
|
0 commit comments