Hello everybody.
I'm trying to get https requests to route to a docker container.
I have a very simple docker-compose file with the following configuration. No other config file.
version: "3"
services:
reverse-proxy:
image: traefik:v2.10
command:
--api.insecure=true
--api.dashboard=true
--api.debug=true
--providers.docker
--entryPoints.web.address=:80
--entryPoints.websecure.address=:443
ports:
- "80:80"
- "443:443"
- "8080:8080"
volumes:
- /var/run/docker.sock:/var/run/docker.sock
networks:
- traefik
whoami:
image: traefik/whoami
labels:
- "traefik.http.routers.whoami.rule=Host(`whoami.docker.localhost`)"
- "traefik.http.routers.whoami.entrypoints=websecure"
- "traefik.http.routers.whoami.tls=true"
networks:
- traefik
api:
build: # ...
labels:
- "traefik.http.routers.api.rule=Host(`api.localhost`)"
- "traefik.http.routers.api.entrypoints=websecure"
- "traefik.http.routers.api.tls=true"
networks:
- traefik
networks:
traefik:
name: traefikExt
driver: bridge
Calling the api with http requests returns an OK response, but https returns 404.
Curl with http:
$ curl -H Host:api.localhost http://127.0.0.1
API IS LIVE
Curl with https:
$ curl --insecure -H Host:api.localhost https://127.0.0.1
404 page not found
Curiously, the whoami service does work with https, even though they seem to have the exact same tags in the docker-compose file.
$ curl --insecure -H Host:whoami.docker.localhost https://127.0.0.1
Hostname: 079b95fbd67f
...
On the contrary, whoami actually returns 404 when queried with http.
Could you help me understand why this happens and how could I get https routing correctly to my service? I'm very new to traefik and there are some very similar topics already, but probably none with quite as simple of a case as mine, so sorry if I'm missing something very obvious.