---
title: Domains
description: This section outlines how to configure domains for your applications in Dokploy, ensuring that your applications are accessible via custom URLs.
---

import { Callout } from 'fumadocs-ui/components/callout';
import { Link } from 'next/link';

Dokploy Provide 2 ways to add a domain to your service:

1. **Free Domains** from Traefik.me
2. **Buy a domain** from one of the providers above

<Callout type="warn">
   `traefik.me` domains are free, but they are limited to HTTP only, if you want to configure HTTPS for free domains
   you can [Create a certificate](/docs/core/certificates#traefikme-https-setup) and use it in the domain settings.
</Callout>

If you don't have a domain, you can use our integrated free domains from Traefik.me in the Dokploy panel, without doing any configuration however is only for HTTP, if you want to have a HTTPS domain you need to buy a domain from one of the providers above.

Domains are supported for:

- **Applications**
- **Docker Compose**

## How Domains Are Managed

Dokploy handles domains differently depending on whether you're using Applications or Docker Compose:

### Applications

For **Applications**, Dokploy creates a unique configuration file for each domain you create or update. These files are managed automatically and can be viewed in:

- **Traefik File System**: Accessible through the Dokploy UI
- **Advanced Settings**: Scroll to the bottom of the Advanced tab to view the Traefik configuration

Each domain configuration follows this structure:

```yaml
http:
  routers:
    dokploy-app-name-router-1:
      rule: Host(`your-domain.com`)
      service: dokploy-app-name-service-1
      middlewares:
        - redirect-to-https
      entryPoints:
        - web
    dokploy-app-name-router-websecure-1:
      rule: Host(`your-domain.com`)
      service: dokploy-app-name-service-1
      middlewares: []
      entryPoints:
        - websecure
      tls:
        certResolver: letsencrypt
  services:
    dokploy-app-name-service-1:
      loadBalancer:
        servers:
          - url: http://dokploy-app-name:3000
        passHostHeader: true
```

**Key Points for Applications:**

- **No Redeployment Required**: Changes to domains take effect immediately without needing to redeploy your application
- **Hot Reload**: Dokploy uses Traefik's [File Provider](https://doc.traefik.io/traefik/reference/install-configuration/providers/others/file/) which supports hot reloading, so configuration changes are applied automatically
- **Troubleshooting**: If you make changes and your domain doesn't work, check the Traefik logs for any errors. The logs should provide helpful information about what might be wrong

### Docker Compose

For **Docker Compose**, domains are managed using [Traefik Docker Labels](https://doc.traefik.io/traefik/expose/docker/). This means:

- **No Configuration Files**: Domains are configured directly through Docker labels in your compose file
- **Redeployment Required**: Unlike Applications, you **must redeploy** your Docker Compose application for domain changes to take effect
- **No Hot Reload**: Docker Compose does not support hot reloading of domain configurations, so Traefik needs to read the labels from a fresh deployment

**Key Points for Docker Compose:**

- Each time you modify a domain, you need to redeploy the application
- Domain changes are applied when Traefik reads the Docker labels during deployment
- For more details on configuring domains manually with Docker Compose, see the [Docker Compose Domains guide](/docs/core/docker-compose/domains)

## Requirements (Optional)

We recommend this if you want to have a HTTPS domain, you need to buy a domain from one of the providers above.

- [Cloudflare](https://www.cloudflare.com/)
- [Porkbun](https://porkbun.com/)
- [Namecheap](https://www.namecheap.com/domains/)
- [Name.com](https://www.name.com/)
- [GoDaddy](https://www.godaddy.com/)
- [Domain.com](https://www.domain.com/)

### Add Domain

Associate custom domains with your application to make it accessible over the internet.

- **Host**: The domain name that you want to link to your application (e.g., `api.dokploy.com`).
- **Path**: The specific path within the domain where the application should be accessible.
- **Internal Path**: The internal path where your application expects to receive requests.
- **Strip Path**: Removes the **Path** from the request before forwarding to the application.
- **Container Port**: The port on the container that the domain should route to.
- **HTTPS**: Toggle this on to enable HTTPS for your domain, providing secure, encrypted connections.
- **Certificate**: Select (letsencrypt) or (None)

For how **Internal Path** and **Strip Path** work using Traefik middlewares, see the note below.

### Note

Proper domain configuration is crucial for the accessibility and security of your application. Always verify domain settings and ensure that DNS configurations are properly set up to point to the correct IP addresses. Enable HTTPS to enhance security and trust, especially for production environments.

### Understanding Internal Path and Strip Path

Dokploy uses Traefik middlewares to modify request paths before they reach your application. These powerful tools allow you to create flexible routing configurations that match your application's expected URL structure.

<Callout type="warn">
**Warning: Potential Redirect Issues**

When using Internal Path and Strip Path middlewares, ensure your application is properly configured to handle the modified paths. If your application generates redirects or absolute URLs that don't match the expected path structure, it may cause redirect loops or broken functionality. Use these middlewares with caution and test thoroughly to ensure your application works correctly with the path transformations.
</Callout>

**Internal Path Middleware**

The Internal Path middleware adds a prefix to the request path before forwarding it to your container. This is useful when your application expects all requests to start with a specific base path.

**Example:**
- Domain: `api.dokploy.com`
- Path: `/v1`
- Internal Path: `/backend/api`
- Request: `api.dokploy.com/v1/users`
- Forwarded to container as: `/backend/api/users`

In this example, the middleware adds `/backend/api` to the beginning of the request path, which is helpful when your application is structured to expect requests at a specific internal directory.

**Strip Path Middleware**

The Strip Path middleware removes a specified path prefix from the request before forwarding it to your container. This is perfect when you want to organize your public URLs with prefixes but your application expects clean, unprefixed paths.

**Example:**
- Domain: `app.dokploy.com`
- Path: `/dashboard`
- Strip Path: Enabled
- Request: `app.dokploy.com/dashboard/settings`
- Forwarded to container as: `/settings`

Here, the middleware removes the `/dashboard` prefix, so your application receives the request as if it was made directly to `/settings`.

**Using Both Internal Path and Strip Path Together**

You can combine both middlewares to create sophisticated routing scenarios. When both are enabled, Strip Path is applied first, then Internal Path is added.

**Example:**
- Domain: `service.dokploy.com`
- Path: `/public`
- Strip Path: Enabled
- Internal Path: `/app/v2`
- Request: `service.dokploy.com/public/api/users`
- Processing:
  1. Strip Path removes `/public`: `/api/users`
  2. Internal Path adds `/app/v2`: `/app/v2/api/users`
- Final forwarded path: `/app/v2/api/users`

This powerful combination allows you to:
- Remove public-facing path prefixes that users see
- Add internal path prefixes that your application requires
- Create clean separation between your public URL structure and internal application structure

**When to Use Each Option**

- **Internal Path only**: When your application requires a specific base path that differs from your public URL
- **Strip Path only**: When you want organized public URLs but your application expects clean paths
- **Both together**: When you need to transform public URLs to match complex internal application structures

These middlewares ensure your application receives requests in the exact format it expects, regardless of how you structure your public domain paths.


### Important Clarification on Container Ports

The "Container Port" specified in the domain settings is exclusively for routing traffic to the correct application container through Traefik, and does not expose the port directly to the internet. This is fundamentally different from the port settings in the "Advanced -> Ports" section, which are used to directly expose application ports. The container port in the domain settings ensures that Traefik can internally direct traffic to the specified port within the container based on the domain configuration.

## Static Build Type

When using the `Static` build type or `Nixpacks` and `Publish Directory` build type, you need to use the port `80` when creating a domain.


## Adding WWW to your domain

If you want to add WWW to your domain, you can do it by adding a CNAME record to your DNS provider.

For example, if your domain is `example.com`, you can add a CNAME record to your DNS provider with the following configuration:

- TYPE: CNAME
- NAME: www
- VALUE: example.com

Create the domain in dokploy, using the host `www.example.com`

Now in dokploy, you can go to application -> advanced -> redirects (Select the preset www to non-www) and click on save.

now everytime you access `www.example.com` it will redirect to `example.com`
