Protect a custom.yml app with Traefik and a login
Deployrr does not put a container from your own custom.yml behind Traefik for you. You do it yourself, with a rules file or with labels. This page shows both ways and when to pick each.
- Option 1: Traefikify. Deployrr asks a few questions and writes a rules file. The container publishes a port on your server. Pick this if you have a Plus or Pro license and want menus to manage the login later.
- Option 2: Labels. You add Traefik labels to the service in
custom.yml. The container does not need to publish a port. It needs no license beyond the one for Traefik setup. You edit the labels by hand when you change something later.
Before you start
Section titled “Before you start”custom.ymlis turned on and your service runs. See Add your own containers with custom.yml.- Traefik is set up and running. See Set up Traefik.
- The login method you want is installed. See Choose a login method. No Authentication and Basic HTTP Auth are there after Traefik setup. The other methods are apps you install first.
- A wildcard DNS record (
*.YOUR_DOMAIN) that you created, and that Prerequisites > Domain Checks verified, covers every new subdomain. ReplaceYOUR_DOMAINwith your domain. Without a wildcard, add a record for the new name first. - You know which port the app listens on inside the container. The image’s page on Docker Hub usually says.
Option 1: Traefikify
Section titled “Option 1: Traefikify”Traefikify needs a Plus or Pro license and the Hybrid setup mode. See Licenses and Setup Mode: Local or Hybrid.
-
Open
custom.ymland give your service a published port. The number on the left is the port on your server. The number on the right is the port inside the container. Pick a left number no other app uses.services:myapp:image: YOUR_IMAGEcontainer_name: myapprestart: unless-stoppedports:- "8095:80"Replace
YOUR_IMAGEwith your image. Change80to the container port from the image’s page. -
Apply the change.
Terminal window dcup myapp -
Open
http://YOUR_SERVER_IP:8095in a browser on your network. ReplaceYOUR_SERVER_IPwith your server’s local IP address. You should see the app. -
In Deployrr, go to Proxy > Traefik > Traefikify.
-
Enter a name and a subdomain. The name becomes the file name
app-NAME.yml. Use a name that differs from any router name in your own labels. -
At Host IP Address of the App, enter your server’s local IP address. There is no default.
-
At WebUI protocol, enter
http, unless the app answers on HTTPS only. -
At WebUI port number of the App, enter the left number from step 1, such as
8095. -
Pick a login method and an exposure method.
See Put any app behind Traefik with Traefikify for every prompt. To see an app from a hand-made compose file put behind Traefik this way, watch Deployrr 5 walkthrough: Put a custom app behind Traefik with Traefikify at 1:29:56 (shows Deployrr v5; menus differ in v6).
The published port stays open. Anyone on your network can still open http://YOUR_SERVER_IP:8095 without the login. If that matters, use Option 2, which needs no published port.
Deployrr writes a rules file named app-NAME.yml. After that, Security > Manage Auth (Pro) and Proxy > Traefik > Manage Exposure (Plus or Pro) list it, and a saved change needs no restart. To edit the file by hand, see Edit Traefik rules files safely.
Option 2: Labels in custom.yml
Section titled “Option 2: Labels in custom.yml”With labels, Traefik reaches the container over the traefik_proxy network. It uses the port inside the container, so you do not publish a port.
-
Open
custom.ymland add the labels and the network to your service.services:myapp:image: YOUR_IMAGEcontainer_name: myapprestart: unless-stoppednetworks:- default- traefik_proxylabels:- "traefik.enable=true"- "traefik.http.routers.myapp-rtr.entrypoints=websecure-internal,websecure-external"- "traefik.http.routers.myapp-rtr.rule=Host(`myapp.$DOMAINNAME_1`)"- "traefik.http.routers.myapp-rtr.middlewares=chain-basic-auth@file"- "traefik.http.routers.myapp-rtr.service=myapp-svc"- "traefik.http.services.myapp-svc.loadbalancer.server.port=80" -
Change these values:
- Replace
YOUR_IMAGEwith your image. - Replace each
myappin the labels with your own short name. Router and service names must be unique across all your apps. See Two files use the same names. - Replace
myappinHost(...)with the subdomain you want. - Change
80to the port inside the container. - Change
chain-basic-authto the chain for your login method. See the table below.
- Replace
-
Save the file and apply it.
Terminal window dcup myapp
Keep @file after the chain name. Leave $DOMAINNAME_1 as it is. It is your domain from your .env file.
To see the same idea built by hand, watch Traefik 3 guide: Docker labels for an app behind Traefik at 5:06 (manual setup; its network is called t3_proxy, in Deployrr v6 it is traefik_proxy). For background on how the labels work, read UDMS part 18: Portainer behind Traefik using Docker labels (manual setup, not the steps to follow in Deployrr v6).
Chain names
Section titled “Chain names”| Chain | Login method |
|---|---|
chain-no-auth |
No Authentication |
chain-basic-auth |
Basic HTTP Auth |
chain-authelia |
Authelia |
chain-authentik |
Authentik |
chain-oauth |
Google OAuth |
chain-tinyauth |
TinyAuth |
Deployrr does not check a label you write. Traefik setup creates only chain-basic-auth and chain-no-auth. For any other chain, install that login method first.
Change the login or exposure later
Section titled “Change the login or exposure later”Edit the label yourself.
- In
custom.yml, change the chain in themiddlewareslabel, for example tochain-authelia@file. - Run
dcup myappagain. Compose recreates the container because its labels changed.
To watch this change made once, see Authelia guide: Change an app’s chain to chain-authelia at 28:59 (manual setup). For background, read UDMS part 19: Putting Docker services behind Authelia with labels (manual setup).
Do the same for exposure, in the entrypoints label:
| Entry points | Reachable |
|---|---|
websecure-internal,websecure-external |
On your LAN and from the internet |
websecure-internal |
On your LAN only |
websecure-external |
From the internet only |
The difference between these three only holds in Advanced mode. In Simple mode your router sends ports 80 and 443 to the internal entry points. See Simple vs Advanced Traefik mode.
Check it worked
Section titled “Check it worked”- Open
https://SUBDOMAIN.YOUR_DOMAINin a private browser window. ReplaceSUBDOMAINandYOUR_DOMAINwith your own values. - You see your login page, or the app if you picked No Authentication.
- Log in. The app opens.
- If you set the app to External or Both in Advanced mode, turn off Wi-Fi on your phone and open the same address.
If it does not work
Section titled “If it does not work”404 page not found. Traefik has no route for the address. Check these:
- Option 2:
traefik.enable=trueis in the labels. Without it, Traefik ignores the container. - Option 2: the service lists
traefik_proxyundernetworks:. Rundcup myappagain after you add it. - The subdomain in the browser matches the
Host(...)label or therule:line in the rules file. - In Advanced mode, the exposure fits where you are. An app set to Internal gives a 404 from outside your home.
- No other app uses the same
-rtror-svcname. - The login chain belongs to a method that is installed. If not, the route fails. The Traefik log says
middleware "chain-NAME@file" does not exist. Install the method or use a chain you have.
502 Bad Gateway or Gateway Timeout. Traefik found the route but not the app. Check the port:
- Option 1: use the host port, the left number in
ports:. - Option 2: use the container port, the number inside the container.
- The app is running. Run
dpsand look for a status that starts withUp. It also lists stopped containers.
For the full checklist, see One app behind Traefik shows 404, 502 or Gateway Timeout. To read the logs, see Read the Traefik logs.
If the app needs to talk to another container, see Connect your apps to each other.

