Use traefik as name based virtual hosts with only one public IP and port 443

Hi,

I read trough some support pages and documentation, however I did never find any statement if name based virtual hosting is working with traefik.

My scenario is the following
I only have one public IP available and I want to use the Port 443 for all connections and want to forward for example 3 subdomains to 3 different backends.

f.e.:
external: 172.16.100.100 Port 443 is having an A record of web.example.com, cloud.example.com, document.example.com

Internal 1: 192.168.1.10
Internal 2: 192.168.1.11
Internal 3: 192.168.1.12

so if want to access ttps://web.example.com I should first get to the traefic server, then it should forward the traffic to Internal server 1.
If I want to get to ttps://cloud.example.com it should go to Internal 2
and ttps://document.example.com to internal server 3.

I have read that traefik can do Let's Encrypt handling and hosting the certificates too, however is this working with this scenario or am I better off with apache or nginx/openresty?

If traefik can do that, is there any example configs I can check?

thanks devzero

That’s what a reverse proxy like Traefik is doing :slight_smile:

Check simple Traefik example. For proxying to "external" IPs (not containers), you need to use loadbalancer.servers.url in a dynamic config file, loaded with providers.file in static config. Another example.
.

Yes, I saw that ones, however they are only providing examples for one domain.
The question in that case is, do I need, for example if I am starting with this:

to add the second host in the layer where the traefik and whoami one is or do I need to add multiple domains in the command part?

When you want to use separate servers, you can’t use Traefik Configuration Discovery with containers with labels.

Instead you need to create a router and service for each (sub-) domain in dynamic config file. (Example)