Search code examples
traefik

HTTPS redirect traefik v2


I'm trying to setup traefik v2 on a development server we have.

The setup:

Docker serving dozens of nginx containers acting as a frontend for different projects. Every nginx container has a unique domain linked to it. Nginx is running on port 80. Every project has a separate docker-compose (traefik also has a separate docker-compose).

What I'm trying to accomplish:

Proxy all of the containers to traefik and add new ones on the go (new services are stopped/started all the time). Make traefik automatically redirect to HTTPS and contact the appropriate nginx container based on the hostname in order to serve the website.

Question: Is this even possible to do? I've been trying to figure it out for the past day or so but I can't get everything to work. Either the redirect doesn't work or if it does it returns 404.


Solution

  • Managed to find a guide that covers this:

    https://chriswiegman.com/2019/10/serving-your-docker-apps-with-https-and-traefik-2/