How do I set up traefik virtual based hosting for traefik V2?

I am using Traefik in a Docker-Compose set-up. I recently saw that multiple websites (all owned by one person) are mirroring my website and showing up higher in google results.

I found two links on Stack exchange sites discussing what to do.
First Link
Second Link
One of the first steps seems to be to set up virtual "name-based hosting" or "name-based virtual hosting" or something similarly named.
Can someone explain how to do this in the docker-compose file as well as the traefik.yml file?
I really hope to prevent this sort of thing from happening as it appears to be a game of a whack-a-mole!

With traefik that happens naturally if you are using specific host names in your router configuration. It will only save you from dumb proxying, where the proxy does not care to substitute a host header, or dns pointing to your IP, and won't help in any other case.

1 Like