How to set default host container in traefik with docker backend?

I have a reverse proxy setup using traefik. It's great!

I'm trying to figure out how to set it up in such a way that when someone navigates to HOSTNAME

or www.HOSTNAME

, I can use it as the default for a specific container / subdomain of my choice. Let's assume there are valid DNS records.

I have a toml config file here . Then I start a bunch of containers that the docker backend watches and brings up. For example,

static:
    image: myrepo/static
    volumes:
      - /www/static:/www/static
    depends_on:
      - traefik
    labels:
      - "traefik.backend=static"
      - "traefik.frontend.rule=Host:static.$HOSTNAME"

      

The preview is static.HOSTNAME

working right now. Yahoo! But suppose I want to switch to HOSTNAME

to serve as well static.HOSTNAME

.

Any advice would be great! Thank.

+3


source to share


1 answer


You can provide CSV rules:



- "traefik.frontend.rule=Host:<subdomain>.$HOSTNAME,$HOSTNAME"

      

+3


source







All Articles