We were unable to load Disqus. If you are a moderator please see our troubleshooting guide.
I had some trouble following your guide but after I figured out the basics it was still quite helpful for explaining stuff like how middlewares work, so thank you very much.
Thanks for the feedback, I'm glad you found it useful. Let me know if there's anything that I could clarify further!
Well it was partially on me because I'm still not familiar with docker or docker-compose, so for example in the Container Configuration section I didn't even know what labels were or how they're meant to be used until only a few days ago, so my only suggestion would be an addition on how to use/apply labels.
But here's what helped me grasp what I was meant to be doing, a full template/example file such as this: https://gist.github.com/Mau...
I'm sure you have your reasons for using a traefik.toml config but this gives me a more complete picture of what I'm doing.
Also, personally I learn a little easier from videos breaking things down but I understand others prefer this format so don't change on my behalf.
Fair enough! A brief intro to labels probably isn't a bad idea at all.
Thanks for that link, I've given it a bookmark for my own sake.
I shared this post on Reddit a while back and someone also mentioned that you could use command line parameters (the command section in docker-compose) instead of a traefik.toml file, which can definitely be useful for certain deployments. It actually does help to give a more holistic view of the entire process.
Very well written, easy to read, thanks!
Question about the configuration of my domain provider:
I have bought a domain (example.xyz) and configured a CNAME to a dynamic domain (dyn12345.mynetname.mikrotik...).
Is that all or should I configure each subdomain in the configuration of my domain provider? I am planning to expose 3 docker based applications and expect to access them via service1.example.xyz, service2.example.xyz and service3.example.xyz.
Thanks, glad you found it helpful!
You will indeed need to configure CNAME records for each of your services.
I find it nice to keep a single A record (something like home.example.xyz for example, could be anything) pointing to my dynamic IP address, with all of my other subdomains set up with CNAME records pointing to the "main" subdomain.
In your setup, you could have the following:
- CNAME: home.example.xyz -> dyn12345.mynetname.mikrotik...
- CNAME: service1.example.xyz -> home.example.xyz
- CNAME: service2.example.xyz -> home.example.xyz
- CNAME: service3.example.xyz -> home.example.xyz
This approach is nice because if for some reason anything changes with your dynamic domain, you only have a single record to update - the records for each of your services will update "automatically" as soon as the first is changed.
Good luck!
But this means Treafik wil always receive "home.example.xyz". Hoe does it 'know' the user visited for example service1.example.xyz so that it can forward to the right Docker port?
this is THE thing that I don't understand yet.
Btw every guide is focused on the steps to take to configure things. Yours is the first one truly explaining how it works instead. Great job!
Great question!
DNS does not actually perform any HTTP redirection. There are a few decent questions about this online, but I'll summarize.
The actual Host header in the HTTP request will always be exactly what was typed into the address bar, and will not change after being resolved using a CNAME record.
So even though your service1.example.xyz may get resolved to home.example.xyz, which will eventually be resolved to an IP address, the actual request that the server (and Traefik) receives will still have service1.example.xyz as the host in the HTTP header.
Some sources:
RFC 2616, see Section 14.23
How does a browser request from CNAME?
CNAME - how will the url be in the http request
I appreciate the kind words, glad someone is getting some use out of it!
Could you kindly create a post explaining how to use this same syntax
with Nextcloud? This is one of the only configurations I've found that
works for most of my apps. However I'm having an issue with Nextcloud
because it uses the 443 port which is being used by Traefik. When I try
to change the port I just get a 404 error. Any help would be greatly
appreciated.
you can do this with tcp provider instead of http.
Here is an example for unifi controller on 8443.
labels:
- "traefik.enable=true"
## TCP Routers
- "traefik.tcp.routers.unifi-tcp.entrypoints=https"
- "traefik.tcp.routers.unifi-tcp.rule=HostSNI(`unifi.domain.com`)"
- "traefik.tcp.routers.unifi-tcp.tls=true"
- "traefik.tcp.routers.unifi-tcp.tls.passthrough=true"
## TCP Services
- "traefik.tcp.routers.unifi-tcp.service=unifi-tcp-svc"
- "traefik.tcp.services.unifi-tcp-svc.loadbalancer.server.port=8443"
Some services use 2 ports. How to make sure traffic of the secondary port is also passed through the https subdomain?
For example Seafile uses port 8000 for the webUI and port 8082 for syncing files. seafile.mydomain.com successfully shows the webUI, but now I have to configure the address in seafile for file syncing.
Is it possible to use labels to create something like seafile.mydomain.com/sync that forwards to port 8082?