# Adding multiple domains to labels

**URL:** <https://community.traefik.io/t/adding-multiple-domains-to-labels/18934>\
**Category:** Traefik v2\
**Tags:** docker\
**Created:** [June 12, 2023, 10:47am UTC](https://community.traefik.io/t/adding-multiple-domains-to-labels/18934 "2023-06-12T10:47:22Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![itchysudo](https://avatars.discourse-cdn.com/v4/letter/i/9de053/32.png) [@itchysudo](https://community.traefik.io/u/itchysudo)\
**Post date:** [June 12, 2023, 10:47am UTC](https://community.traefik.io/t/adding-multiple-domains-to-labels/18934/1 "2023-06-12T10:47:22Z")

</div>

Hi there,  
First time poster here so apologies if this has been resolved before, I can't seem to find the right solution!  
I'm still a novice user of Docker/traefik/Lets Encrypt - really enjoying it so far.

I currently use Traefik/Let's Encrypt successfully for multiple docker containers but would also like to host a WordPress site under a different domain. I've researched and added (what I think..) are the correct labels but my WordPress site still shows up as "not secure".

Any help would be most appreciated. Traefik docker-compose below!

```auto
version: '3'

services:
  traefik:
    image: traefik:latest
    container_name: traefik
    restart: unless-stopped
    security_opt:
      - no-new-privileges:true
    networks:
      - proxy
    ports:
      - 80:80
      - 443:443
    environment:
      - CF_API_EMAIL= <EMAIL>
      - CF_DNS_API_TOKEN= <tOKEN>
      - CF_API_KEY= <KEY>
    volumes:
      - /etc/localtime:/etc/localtime:ro
      - /var/run/docker.sock:/var/run/docker.sock:ro
      - /home/afmod/traefik/data/traefik.yml:/traefik.yml:ro
      - /home/afmod/traefik/data/acme.json:/acme.json
      - /home/afmod/traefik/data/config.yml:/config.yml:ro

    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.traefik.entrypoints=http"
      - "traefik.http.routers.traefik.rule=Host(`traefik-dashboard.domain.domain.domain`)"
      - "traefik.http.middlewares.traefik-auth.basicauth.users=afmod:<PASSWORD>
      - "traefik.http.middlewares.traefik-https-redirect.redirectscheme.scheme=https"
      - "traefik.http.middlewares.sslheader.headers.customrequestheaders.X-Forwarded-Proto=https"
      - "traefik.http.routers.traefik.middlewares=traefik-https-redirect"
      - "traefik.http.routers.traefik-secure.entrypoints=https"
      - "traefik.http.routers.traefik-secure.rule=Host(`traefik-dashboard.domain.domain.domain`)"
      - "traefik.http.routers.traefik-secure.middlewares=traefik-auth"
      - "traefik.http.routers.traefik-secure.tls=true"
      - "traefik.http.routers.traefik-secure.tls.certresolver=cloudflare"
      - "traefik.http.routers.traefik-secure.tls.domains[0].main=domain.domain.domain"
      - "traefik.http.routers.traefik-secure.tls.domains[0].sans=*.domain.domain.domain"
      - "traefik.http.routers.traefik-secure.tls.domains[1].main=domain2.domain2.domain2"
      - "traefik.http.routers.traefik-secure.tls.domains[1].sans=*.domain2.domain2.domain2"
      - "traefik.http.routers.traefik-secure.service=api@internal"

networks:
  proxy:
    external: true

```

---

<div class="post-metadata">

**Author:** ![bluepuma77](https://avatars.discourse-cdn.com/v4/letter/b/a9adbd/32.png) [@bluepuma77](https://community.traefik.io/u/bluepuma77)\
**Post date:** [June 12, 2023, 2:16pm UTC](https://community.traefik.io/t/adding-multiple-domains-to-labels/18934/2 "2023-06-12T14:16:11Z")

</div>

Show your Traefik static and dynamic config and your Wordpress dynamic config 🙂

---

<div class="post-metadata">

**Author:** ![itchysudo](https://avatars.discourse-cdn.com/v4/letter/i/9de053/32.png) [@itchysudo](https://community.traefik.io/u/itchysudo)\
**Post date:** [June 12, 2023, 2:26pm UTC](https://community.traefik.io/t/adding-multiple-domains-to-labels/18934/3 "2023-06-12T14:26:30Z")

</div>

Hi Bluepuma,

Thanks for replying - apologies, would this be my acme.json and config.yml files?

Wordpress config below. Thanks for your help!

```auto

version: '3.1'

networks:
  traefik:
    external: true
  backend:

services:

  wordpress:
    image: wordpress
    restart: always
    ports:
      - 8080:80
    environment:
      WORDPRESS_DB_HOST: db
      WORDPRESS_DB_USER: dbuser
      WORDPRESS_DB_PASSWORD: <"pass">
      WORDPRESS_DB_NAME: <"DBNAME">
    volumes:
      - wordpress:/var/www/html

    networks:
      - traefik
      - backend

    depends_on:
      - db
      - redis

      labels:
      # The labels are usefull for Traefik only
      - "traefik.enable=true"
      - "traefik.docker.network=traefik"
      # Get the routes from http
      - "traefik.http.routers.wordpresscp.rule=Host(`domain2.domain2.domain2.domain2`)"
      - "traefik.http.routers.wordpresscp.entrypoints=web"
      # Redirect these routes to https
      - "traefik.http.middlewares.redirect-to-https.redirectscheme.scheme=https"
      - "traefik.http.routers.wordpresscp.middlewares=redirect-to-https@docker"
      # Get the routes from https
      - "traefik.http.routers.wordpresscp-secured.rule=Host(`domain2.domain2.domain2.domain2`)"
      - "traefik.http.routers.wordpresscp-secured.entrypoints=web-secure"
      # Apply autentificiation with http challenge
      - "traefik.http.routers.wordpresscp-secured.tls=true"
      - "traefik.http.routers.wordpresscp-secured.tls.certresolver=myhttpchallenge"

    links:
      - db:db

  db:
    image: mysql:5.7
    restart: always

```

---

<div class="post-metadata">

**Author:** ![bluepuma77](https://avatars.discourse-cdn.com/v4/letter/b/a9adbd/32.png) [@bluepuma77](https://community.traefik.io/u/bluepuma77)\
**Post date:** [June 12, 2023, 2:37pm UTC](https://community.traefik.io/t/adding-multiple-domains-to-labels/18934/4 "2023-06-12T14:37:59Z")

</div>

Labels seems to be spaced wrong.

---

<div class="post-metadata">

**Author:** ![itchysudo](https://avatars.discourse-cdn.com/v4/letter/i/9de053/32.png) [@itchysudo](https://community.traefik.io/u/itchysudo)\
**Post date:** [June 12, 2023, 2:46pm UTC](https://community.traefik.io/t/adding-multiple-domains-to-labels/18934/5 "2023-06-12T14:46:15Z")

</div>

Good catch - I can tab them again so they firmly sit under labels. Pretty ironic that this came from wordPress' page on Docker hub!

---

<div class="post-metadata">

**Author:** ![itchysudo](https://avatars.discourse-cdn.com/v4/letter/i/9de053/32.png) [@itchysudo](https://community.traefik.io/u/itchysudo)\
**Post date:** [June 12, 2023, 2:49pm UTC](https://community.traefik.io/t/adding-multiple-domains-to-labels/18934/6 "2023-06-12T14:49:33Z")

</div>

I have made the change - definitely helps but still same issue unfortunately...

---

<div class="post-metadata">

**Author:** ![bluepuma77](https://avatars.discourse-cdn.com/v4/letter/b/a9adbd/32.png) [@bluepuma77](https://community.traefik.io/u/bluepuma77)\
**Post date:** [June 12, 2023, 2:52pm UTC](https://community.traefik.io/t/adding-multiple-domains-to-labels/18934/7 "2023-06-12T14:52:50Z")

</div>

One network is named `proxy`, one `traefik`. Need to place them on the same network 🙂

Check your Traefik dashboard.

---

<div class="post-metadata">

**Author:** ![itchysudo](https://avatars.discourse-cdn.com/v4/letter/i/9de053/32.png) [@itchysudo](https://community.traefik.io/u/itchysudo)\
**Post date:** [June 12, 2023, 3:04pm UTC](https://community.traefik.io/t/adding-multiple-domains-to-labels/18934/8 "2023-06-12T15:04:25Z")

</div>

Interesting - I didn't even see that at all. I checked the compose files for my functioning containers and they all seem to use -proxy so I'm assuming I should change to that. I can't see WordPress at all within the Traefik dashboard.

Would I be correct in changing the network in the below place on the wordpress compose?

> [@itchysudo](#):
>
> ```auto
> networks:
> - traefik
> - backend
> 
> ```
