# Router configuration doesn't recognize same hostname for HTTP to HTTPS redirect

**URL:** https://community.traefik.io/t/router-configuration-doesnt-recognize-same-hostname-for-http-to-https-redirect/2262
**Category:** Traefik v2
**Tags:** docker
**Created:** [October 10, 2019, 4:07am UTC](https://community.traefik.io/t/router-configuration-doesnt-recognize-same-hostname-for-http-to-https-redirect/2262 "2019-10-10T04:07:06Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![partydrone](https://sea2.discourse-cdn.com/flex020/user_avatar/community.traefik.io/partydrone/32/890_2.png) [@partydrone](https://community.traefik.io/u/partydrone)
#### Post date: [October 10, 2019, 4:07am UTC](https://community.traefik.io/t/router-configuration-doesnt-recognize-same-hostname-for-http-to-https-redirect/2262/1 "2019-10-10T04:07:06Z")

</div>

Following [the instructions in the documentation](https://docs.traefik.io/v2.0/migration/v1-to-v2/#http-to-https-redirection-is-now-configured-on-routers) to redirect HTTP to HTTPS, Traefik doesn't seem to recognize the same hostname on that service.

Here is my **traefik.yml** :

```yaml
api:
  insecure: true

entryPoints:
  web:
    address: :80

  web-secure:
    address: :443

log:
  level: ERROR

providers:
  docker:
    exposedByDefault: false

  file:
    filename: /etc/traefik/dynamic_config.yml

```

Here is my **dynamic\_config.yml** :

```yaml
http:
  middlewares:
    secureRedirect:
      redirectScheme:
        scheme: https

tls:
  certificates:
    - certFile: /etc/ssl/math.crt
      keyFile: /etc/ssl/math.key

```

And here is the relevant portion of **docker-compose.yml** :

```yaml
version: '3.7'

services:
  ##
  # Think Through Math

  apangea:
    build: ./apangea-docker
    depends_on:
      - postgres
      - proxy
      - redis
    env_file:
      - .env
      - ./env/app/apangea.env
      - ./env/local/redis.env
      - ./env/service/auth0.env
      - ./env/service/aws.env
      - ./env/service/clever.env
      - ./env/service/google.env
    healthcheck:
      test: ["CMD", "curl", "-f", "http://localhost:5000/health"]
      interval: 30s # frequency of health check
      retries: 3 # numbe r of times to retry on failure
      start_period: 30s # time to wait for the container to bootstrap
      timeout: 10s # time allowed for each check to complete
    labels:
      - traefik.enable=true
      - traefik.http.routers.apangea.entryPoints=web
      - traefik.http.routers.apangea.middlewares=secureRedirect@file
      - traefik.http.routers.apangea.rule=Host(`math.localhost`)
      - traefik.http.routers.apangea-secured.entryPoints=web-secure
      - treafik.http.routers.apangea-secured.rule=Host(`math.localhost`)
      - traefik.http.routers.apangea-secured.tls=true
    stdin_open: true
    tty: true
    volumes:
      - ./apangea-docker:/srv/apangea
      - ./apangea-docker/public:/srv/apangea/public
      - apangea-sync:/srv/apangea:nocopy
      - /srv/apangea/public/assets
      - type: tmpfs
        target: /srv/apangea/tmp/pids/

```

As you can see, both the `apangea` and `apangea-secured` routers have a `rule=Host(`math.localhost`)` declaration, but Traefik only seems to recognize the first one, as can be seen in the dashboard:

 ![20%20PM](https://us1.discourse-cdn.com/flex020/uploads/containo/original/1X/fb85e258ab0b41e0040472c0b8c4c586ba14a27c.jpeg)

The secure router's hostname is `apangea-maestro` instead of `math.localhost` as expected. When I enter `http://math.localhost` in my browser, it re-routes as expected to `https://math.localhost`, but all I see in the browser is `404 page not found`.

**What am I missing?**

---

<div class="post-metadata">

### Author: ![partydrone](https://sea2.discourse-cdn.com/flex020/user_avatar/community.traefik.io/partydrone/32/890_2.png) [@partydrone](https://community.traefik.io/u/partydrone)
#### Post date: [October 10, 2019, 6:55am UTC](https://community.traefik.io/t/router-configuration-doesnt-recognize-same-hostname-for-http-to-https-redirect/2262/2 "2019-10-10T06:55:53Z")

</div>

There's a typo in the label of `docker-compose.yml`: `treafik` -\> `traefik`.

Problem solved. Things work as expected.
