Few domains to one server; traefik+nginx+docker

Hello guys! That's my first post here.

I have huge server, which serves one web app I am interested in. Server is based on docker, and I have nginx, traefik, phpfpm, nodejs, vue, percona and redis for this web app. I cannot share the configuration file.

Settings for this web app are not exactly behaving as I need them to, I mean nginx and traefik here. When I disable some things in one or the other, the pages are returning 404. However I cannot make the configuration to work properly:
Domain A has domains B, C and D which should redirect to A. And I have domains X, Y and Z where Y and Z should redirect to X. Like that: (B+C+D=>A) and (Y+Z=>X). Web app is one for all domains, but the domains need to be distinguishable by the web app.

Where should I look for configuration about these domains? Currently domains are mentioned in nginx and traefik configurations but when changed they stop working and don't want to redirect. Also there is portainer but seems like it does not configure anything related to domains.

EDIT: Looks like traefik+nginx cannot together redirect domains. Is it true?