Dokku provides integration with the [Traefik](https://traefik.io/) proxy service by utilizing the Docker label-based integration implemented by Traefik.
```
traefik:report [<app>] [<flag>] # Displays a traefik report for one or more apps
Using the `traefik` plugin integration requires the `docker-compose-plugin` for Docker. See [this document](https://docs.docker.com/compose/install/) from the Docker documentation for more information on the installation process for the `docker-compose-plugin`.
> As using multiple proxy plugins on a single Dokku installation can lead to issues routing requests to apps, doing so should be avoided. As the default proxy implementation is nginx, users are encouraged to stop the nginx service before switching to Traefik.
To use the Traefik plugin, use the `proxy:set` command for the app in question:
```shell
dokku proxy:set node-js-app traefik
```
This will enable the docker label-based Traefik integration. All future deploys will inject the correct labels for Traefik to read and route requests to containers. Due to the docker label-based integration used by Traefik, a single deploy or rebuild will be required before requests will route successfully.
```shell
dokku ps:rebuild node-js-app
```
Any changes to domains or port mappings will also require either a deploy or rebuild.
### Starting Traefik container
Traefik can be started via the `traefik:start` command. This will start a Traefik container via the `docker compose up` command.
```shell
dokku traefik:start
```
### Stopping the Traefik container
Traefik may be stopped via the `traefik:stop` command.
```shell
dokku traefik:stop
```
The Traefik container will be stopped and removed from the system. If the container is not running, this command will do nothing.
### Showing the Traefik compose config
For debugging purposes, it may be useful to show the Traefik compose config. This can be achieved via the `traefik:show-config` command.
```shell
dokku traefik:show-config
```
### Customizing the Traefik container image
While the default Traefik image is hardcoded, users may specify an alternative by setting the `image` property with the `--global` flag:
```shell
dokku traefik:set --global image traefik:v2.8
```
#### Checking the Traefik container's logs
It may be necessary to check the Traefik container's logs to ensure that Traefik is operating as expected. This can be performed with the `traefik:logs` command.
```shell
dokku traefik:logs
```
This command also supports the following modifiers:
The traefik plugin only supports automatic ssl certificates from it's letsencrypt integration. Managed certificates provided by the `certs` plugin are ignored.
The letsencrypt integration is set to the production letsencrypt server by default. To change this, set the `letsencrypt-server` property with the `--global` flag:
By default, the dashboard is disabled. To enable, set the `dashboard` property with the `--global` flag:
```shell
dokku traefik:set --global dashboard true
```
After enabling, the Traefik container will need to be restarted.
#### Enabling api basic auth
Users enabling either the api or dashboard are encouraged to enable basic auth. This will apply _only_ to the api/dashboard, and not to apps. To enable, set the `basic-auth-username` and `basic-auth-password` properties with the `--global` flag:. Both must be set or basic auth will not be enabled.
After enabling, the Traefik container will need to be restarted.
#### Customizing the api hostname
The hostname used for the api and dashboard is set to `traefik.dokku.me` by default. It can be customized by setting the `api-vhost` property with the `--global` flag:
```shell
dokku traefik:set --global api-vhost lb.dokku.me
```
After enabling, the Traefik container will need to be restarted.
## Displaying Traefik reports for an app
You can get a report about the app's Traefik config using the `traefik:report` command: