# Traefik route only HTTPs but no HTTP (http request result in 404 error)

**URL:** <https://community.traefik.io/t/traefik-route-only-https-but-no-http-http-request-result-in-404-error/2135>\
**Category:** Traefik v2\
**Tags:** docker-swarm, middleware\
**Created:** [October 3, 2019, 7:20pm UTC](https://community.traefik.io/t/traefik-route-only-https-but-no-http-http-request-result-in-404-error/2135 "2019-10-03T19:20:14Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![shiipou](https://sea2.discourse-cdn.com/flex020/user_avatar/community.traefik.io/shiipou/32/847_2.png) [@shiipou](https://community.traefik.io/u/shiipou)\
**Post date:** [October 3, 2019, 7:20pm UTC](https://community.traefik.io/t/traefik-route-only-https-but-no-http-http-request-result-in-404-error/2135/1 "2019-10-03T19:20:14Z")

</div>

Hello there, I have a problem with my traefik configuration for the https redirection :  
(https work but when I request the http port, I receive 404 Error.

**What did you expect to see?**  
I want to see the JSON of my web API :

```json
{
  "_links": {
    "self": {
      "href": "http://archi-data.nocturlab.fr/profile"
    },
    "groups": {
      "href": "http://archi-data.nocturlab.fr/profile/groups"
    },
    "texts": {
      "href": "http://archi-data.nocturlab.fr/profile/texts"
    },
    "languages": {
      "href": "http://archi-data.nocturlab.fr/profile/languages"
    },
    "translations": {
      "href": "http://archi-data.nocturlab.fr/profile/translations"
    },
    "users": {
      "href": "http://archi-data.nocturlab.fr/profile/users"
    },
    "accesses": {
      "href": "http://archi-data.nocturlab.fr/profile/accesses"
    }
  }
}

```

**What did you see instead?**  
I see the Traefik v2 404 error message :

```auto
404 page not found

```

**Output of traefik version: (What version of Traefik are you using?)**

```bash
/srv/stacks : docker exec -it 43dc32702fd9 traefik version
Version: 2.0.1
Codename: montdor
Go version: go1.13.1
Built: 2019-09-26T16:18:03Z
OS/Arch: linux/amd64

```

**What is your environment & configuration (arguments, toml, provider, platform, ...)?**

```yaml
version: "3.7"
services:
  ingress:
    image: traefik:v2.0
    networks:
      - traefik-net
    ports:
      - "80:80"
      - "443:443"
    command:
      ### ###
      # Traefik Global Configuration #
      ### ###
      # Enable DEBUG logs
      - "--log.level=INFO"
      # Enable api access without authentification (only GET route so it only possible to get IPs)
      - "--api.insecure=true"
      # Set the provider to Docker
      - "--providers.docker=true"
      # Set the docker network
      - "--providers.docker.network=traefik-net"
      # Set to docker swarm cluster
      - "--providers.docker.swarmMode=true"
      # If False : Do not expose containers to the web by default
      - "--providers.docker.exposedbydefault=false"
      # Default rule to service-name.nocturlab.fr
      - "--providers.docker.defaultRule=Host(`{{ trimPrefix `/` .Name }}.nocturlab.fr`)"
      # Default http port
      - "--entrypoints.http.address=:80"
      # Default https port
      - "--entrypoints.https.address=:443"
      # Enable let's encrypt
      - "--certificatesresolvers.certbot.acme.httpchallenge=true"
      - "--certificatesresolvers.certbot.acme.httpchallenge.entrypoint=http"
      - "--certificatesresolvers.certbot.acme.email=admin@nocturlab.fr"
      - "--certificatesresolvers.certbot.acme.storage=/letsencrypt/acme.json"
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock:ro
      - ./acme.json:/letsencrypt/acme.json
    deploy:
      replicas: 1
      labels:
        ### ###
        # Traefik Dashboard #
        ### ###
        # Enable this endpoint
        - traefik.enable=true
        # Set the service route
        - traefik.http.routers.ingress.rule=Host(`panel.nocturlab.fr`)
        # Set the service port
        - traefik.http.services.ingress.loadbalancer.server.port=8080
        # Set the entrypoint (http & https)
        - traefik.http.routers.ingress.entrypoints=http,https
        # Enable Let's encrypt auto certificat creation
        - traefik.http.routers.ingress.tls.certresolver=certbot
        # Rule to redirect to http to https
        - traefik.http.middlewares.ingress-https-redirect.redirectscheme.scheme=https
        # Enable authentification and https
        - traefik.http.routers.ingress.middlewares=ingress-https-redirect@docker,ingress-auth@docker
        # Uncommant this to enable basic authentification
        - traefik.http.middlewares.ingress-auth.basicauth.users=admin: **{{my_password}}**
      placement:
        constraints: [node.hostname == nocturlab-vps]
    
networks:
  traefik-net:
    external: true

```

My provider is docker (swarm mode enabled)

**If applicable, please paste the log output in DEBUG level (--log.level=DEBUG switch)**

```auto
/srv/stacks : docker logs 43dc32702fd9 -f 
time="2019-09-27T12:30:31Z" level=info msg="Configuration loaded from flags."
time="2019-09-27T12:30:31Z" level=info msg="Traefik version 2.0.1 built on 2019-09-26T16:18:03Z"
time="2019-09-27T12:30:31Z" level=info msg="\nStats collection is disabled.\nHelp us improve Traefik by turning this feature on :)\nMore details on: https://docs.traefik.io/v2.0/contributing/data-collection/\n"
time="2019-09-27T12:30:32Z" level=info msg="Starting provider aggregator.ProviderAggregator {}"
time="2019-09-27T12:30:32Z" level=info msg="Starting provider *acme.Provider {\"email\":\"admin@nocturlab.fr\",\"caServer\":\"https://acme-v02.api.letsencrypt.org/directory\",\"storage\":\"/letsencrypt/acme.json\",\"keyType\":\"RSA4096\",\"httpChallenge\":{\"entryPoint\":\"http\"},\"ResolverName\":\"certbot\",\"store\":{},\"ChallengeStore\":{}}"
time="2019-09-27T12:30:32Z" level=info msg="Testing certificate renew..." providerName=certbot.acme
time="2019-09-27T12:30:32Z" level=info msg="Starting provider *docker.Provider {\"watch\":true,\"endpoint\":\"unix:///var/run/docker.sock\",\"defaultRule\":\"Host(`{{ normalize .Name }}`)\",\"swarmMode\":true,\"network\":\"traefik-net\",\"swarmModeRefreshSeconds\":15000000000}"

```

Thank you for your help

---

<div class="post-metadata">

**Author:** ![raph](https://avatars.discourse-cdn.com/v4/letter/r/e8c25b/32.png) [@raph](https://community.traefik.io/u/raph)\
**Post date:** [October 4, 2019, 8:58am UTC](https://community.traefik.io/t/traefik-route-only-https-but-no-http-http-request-result-in-404-error/2135/2 "2019-10-04T08:58:54Z")

</div>

Hello,

you can make 2 routers, one for https, one for http, works for me

```auto
    labels:
      - "traefik.enable=true"
  
      # routers
      - "traefik.http.routers.https_dashboard.middlewares=admin-auth@file"
      - "traefik.http.routers.https_dashboard.rule=Host(`traefik.domain`)"
      - "traefik.http.routers.https_dashboard.entrypoints=https"
      - "traefik.http.routers.https_dashboard.tls.certresolver=certbot"

      - "traefik.http.middlewares.https-redirect.redirectscheme.scheme=https"
      - "traefik.http.routers.http_dashboard.rule=Host(`traefik.domain`)"
      - "traefik.http.routers.http_dashboard.entrypoints=http"
      - "traefik.http.routers.http_dashboard.middlewares=https-redirect@docker"

      # services
      - "traefik.http.services.dashboard.loadbalancer.server.port=8080"

```
