C
Coder.com•4mo ago
daschatten

Get subdomain access url

Is there a var to get the generated subdomain access url? I need to add docker labels for traefik auto config. It was mentioned it looks like this: <app>--<agent>--<workspace>--<username>.example.com
Solution:
Thanks, i just tried it without traefik auto config for workspaces, and it just worked 🤣
Jump to solution
20 Replies
Codercord
Codercord•4mo ago
Codercord
Codercord•4mo ago
<#1385615313361567774>
Category
Help needed
Product
Coder (v2)
Platform
Linux
Logs
Please post any relevant logs/error messages.
Phorcys
Phorcys•4mo ago
hey! apologies for the delay, seems like your message went under our radar! so you can't really do it this way but instead need to set up a wildcard subdomain with a wildcard certificate see https://coder.com/docs/admin/setup#wildcard-access-url
daschatten
daschattenOP•4mo ago
Yep, i already have this running. I just thought there is maybe an easier way to get the generated wildcard access url. For now i just build it myself and pass it to traefik for autoconfig. Though it would be great to have a variable with the generated url.
Phorcys
Phorcys•3mo ago
is there a reason you're not just redirecting *.coder.example.com to traefik? you don't need to know all the domains beforehand in this case
daschatten
daschattenOP•3mo ago
I do, though i need to let traefik know to which container the generated domains have to be redirected to. Like this:
No description
daschatten
daschattenOP•3mo ago
It works by manually building the url like this: <app>--<agent>--<workspace>--<username>.example.com Though it would be more convenient to just read them from a app var like coder_app.webui.generated_url
daschatten
daschattenOP•3mo ago
Traefik gets the config directly from docker: https://doc.traefik.io/traefik/providers/docker/
Traefik Docker Documentation - Traefik
Learn how to achieve configuration discovery in Traefik through Docker. Read the technical documentation.
daschatten
daschattenOP•3mo ago
All i need to add is some labels to the docker_config.
Phorcys
Phorcys•3mo ago
that is not needed though, if you route it all through the Coder control plane it'll act as a reverse-proxy are there any constraints in your setup preventing you to do it this way?
daschatten
daschattenOP•3mo ago
Nope, just thought that is necessary for correct routing like all my other containers. Will try the coder way next 🙂
Phorcys
Phorcys•3mo ago
sounds good, let me know if you run into any trouble another quick question, is there anything in particular in our docs that led you to believe this? asking so we can correct our wording
daschatten
daschattenOP•3mo ago
I just assumed this while transferring some docker compose files i wanted to try out. All of my compose files are using docker labels for traefik auto config. Maybe you can visualize the data flow in "Setup -> Reverse Proxy" using a rev proxy, coder and some workspaces.
daschatten
daschattenOP•3mo ago
I just checked other pages in the docs and the image in "Architecture" can be misleading regarding this topic. The Desktop IDEs are pointing to the workspaces directly.
No description
Phorcys
Phorcys•3mo ago
thx!
Ryan Wiancko
Ryan Wiancko•3mo ago
I went through a bunch of hoops getting this to work last week, add tailscale into the mix and SSL and it got fun. If there's anything I can do to help @daschatten just let me know, happy to share as it 's all working now
Solution
daschatten
daschatten•3mo ago
Thanks, i just tried it without traefik auto config for workspaces, and it just worked 🤣
Phorcys
Phorcys•3mo ago
thanks for the follow-up! i'll keep this in mind to see if we can make the docs better!
Codercord
Codercord•3mo ago
@Phorcys closed the thread.

Did you find this page helpful?