Domains and routing
Route a hostname to an application or Compose service, with HTTPS, path rewriting and custom Traefik entrypoints.
Add a domain to an application or a Compose service and Traefik routes the hostname to its container. Without a domain of your own, use a generated domain over HTTP.
How domains are applied
| Applications | Docker Compose | |
|---|---|---|
| Mechanism | One Traefik file per domain (File Provider) | Traefik Docker labels in the compose file |
| Where to see it | Proxy › Config files on the server page, or the proxy config under the service's Settings › Networking | The compose file |
| After a change | Applied immediately, no redeploy | Redeploy required |
For an application with HTTPS, wtree Cloud writes a file like this:
http:
routers:
w3panel-app-name-router-1:
rule: Host(`your-domain.com`)
service: w3panel-app-name-service-1
middlewares:
- redirect-to-https
entryPoints:
- web
w3panel-app-name-router-websecure-1:
rule: Host(`your-domain.com`)
service: w3panel-app-name-service-1
middlewares: []
entryPoints:
- websecure
tls:
certResolver: letsencrypt
services:
w3panel-app-name-service-1:
loadBalancer:
servers:
- url: http://w3panel-app-name:3000
passHostHeader: trueIf a domain change has no effect, check the Traefik logs. For Compose labels, see Compose domains.
Domain settings
Open the service and go to Settings › Domains, then click Add domain.
| Setting | What it does | Default |
|---|---|---|
| Host | Hostname to serve, for example api.example.com. | None |
| Path | Public path prefix the domain answers on. | / |
| Internal path | Prefix added to the request path before it reaches the container. | None |
| Strip path | Removes Path from the request before forwarding. | Off |
| Container port | Port inside the container that Traefik routes to. | None |
| Custom entrypoint | A Traefik entrypoint other than web/websecure. Advanced. | None |
| HTTPS | Serves the domain over TLS. | Off |
| Certificate provider | None, Let's Encrypt or Custom Resolver. | None |
Certificate providers:
- None: uses a certificate you uploaded under Certificates whose name matches the host.
- Let's Encrypt: issues and renews a free certificate.
- Custom Resolver: uses a cert resolver you added to Traefik's static configuration (
traefik.yml), for examplemyresolver. Not for uploaded certificates.
Container port only tells Traefik where to send traffic inside the Docker network. It does not publish the port. To publish a port on the host, use Settings › Networking › Ports.
Apps with the Static build type, or Nixpacks with a Publish Directory, serve on port 80. Use 80 as the container port.
Rewrite paths
Internal path and Strip path are Traefik middlewares. When both are on, Strip path runs first.
| Host | Path | Strip path | Internal path | Request | Container receives |
|---|---|---|---|---|---|
api.example.com | /v1 | Off | /backend/api | /v1/users | /backend/api/users |
app.example.com | /dashboard | On | None | /dashboard/settings | /settings |
service.example.com | /public | On | /app/v2 | /public/api/users | /app/v2/api/users |
If your app builds redirects or absolute URLs that ignore the rewritten path, you can get redirect loops or broken links. Test the app behind the rewrite.
Custom entrypoints
An entrypoint is a port and protocol Traefik listens on. wtree Cloud ships web (HTTP, 80) and websecure (HTTPS, 443). Don't remove or rename them: domain routing, HTTPS and redirects depend on them.
With HTTPS on and no custom entrypoint, wtree Cloud creates one router for web, one for websecure, and a middleware that redirects HTTP to HTTPS.
With a custom entrypoint:
- wtree Cloud creates a single router on that entrypoint only, using HTTP or HTTPS according to the HTTPS setting.
- No HTTP to HTTPS redirect is created. Handle it in the Traefik configuration, or add a second domain on an HTTP entrypoint.
- The entrypoint must already exist in Traefik's static configuration, or the router fails.
entryPoints:
web:
address: ":80"
websecure:
address: ":443"
external-secure:
address: ":8443"
internal-secure:
address: ":9443"Here external-secure can face the internet while internal-secure is bound to a private interface or firewalled. To publish the extra ports through Traefik, see Web server settings.
A wrong entrypoint can make a service unreachable or expose it unintentionally. Use this only if you know Traefik.
Redirect www to the apex domain
- At your DNS host, add a
CNAMErecord: namewww, valueexample.com. - Create a domain in wtree Cloud with the host
www.example.com. - Open the application's Settings › Networking, click Add redirect under Redirects, pick the Redirect to non-www preset and save.
Requests to www.example.com now redirect to example.com.
