> ## Documentation Index
> Fetch the complete documentation index at: https://inframan.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Custom domains

> Give a web service a public hostname with a free Let's Encrypt certificate that renews itself.

A web service is reachable from the internet only through a domain you attach. Each domain gets its own TLS certificate from Let's Encrypt, issued and renewed by Inframan at no cost, and HTTP requests to it are redirected to HTTPS.

> [!NOTE]
>
> Inframan doesn't give services a generated public URL. Without a domain, a service is only reachable from inside the cluster.

## Add a domain

**1. Find the load balancer address**

Open the infrastructure and select the **Domains** tab. It shows the infrastructure's load balancer IP. On AWS there's one IP per zone.

**2. Create the DNS record**

At your DNS provider, create an **A record** for the domain, such as `api.example.com`, pointing at that IP. On AWS, create one A record per IP.

> [!WARNING]
>
> Turn off any proxying for the record, such as Cloudflare's orange cloud. Inframan checks that the domain resolves straight to the load balancer, and Let's Encrypt has to reach it to issue the certificate.

**3. Add it in Inframan**

Under **Application Domains**, enter the **Domain** and add it. Inframan checks the DNS record first, and refuses the domain if it doesn't resolve to the load balancer yet. DNS changes can take a few minutes to spread.

**4. Wait for the certificate**

The domain shows **provisioning** while Let's Encrypt validates it and issues the certificate, then **active**. If it shows **failed**, check the DNS record and retry.

**5. Use it in inframan.yaml**

```yaml inframan.yaml theme={null}
services:
  api:
    port: 8080
    domain: api.example.com
```

Deploy, and the service answers on `https://api.example.com`.

## Route paths to different services

Several services can share one domain on different paths:

```yaml inframan.yaml theme={null}
services:
  web:
    port: 3000
    domain: example.com
    path_prefix: /
  api:
    port: 8080
    domain: example.com
    path_prefix: /api
    path_rewrite: /
```

Requests to `example.com/api/orders` reach `api` as `/orders`, and everything else reaches `web`. A prefix matches whole path segments, so `/api` doesn't catch `/api-docs`.

## A domain per environment

Give non-production its own hostname with an [environment override](https://inframan.mintlify.site/deploy/inframan-yaml.md#environment-overrides):

```yaml inframan.yaml theme={null}
services:
  api:
    port: 8080
    domain: api.example.com
    environments:
      nonprod:
        service:
          domain: api.staging.example.com
```

## Rules

* A domain routes only on the infrastructure it was added to. Using it from an application on another infrastructure fails the release with `DOMAIN_ON_OTHER_INFRASTRUCTURE`.
* A domain that isn't active yet fails the release with `DOMAIN_NOT_ACTIVE`, and one that was never added fails with `DOMAIN_NOT_FOUND`.
* Each domain can be added once.
* Wildcard domains aren't supported.
* Domains serve HTTP and HTTPS only.

## Certificates

Inframan requests certificates from Let's Encrypt's production service with the HTTP-01 challenge, through the infrastructure's own ingress. cert-manager renews each certificate before it expires, with no action from you.

## With an AI assistant

A connected assistant can add a domain, check its status and retry a failed one. It can't delete a domain: that's done from the console.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.